File-sink-rotation-config
Read the current optional rotation configuration from a FileSink. This helper exposes the active direct runtime rotation parameters when rotation is configured.
Interface
pub fn FileSink::rotation_config(self : FileSink) -> FileRotation? {input
self : FileSink- File sink whose current rotation config should be inspected.
output
FileRotation?- Current rotation config, orNoneif rotation is disabled.
Explanation
Detailed rules explaining key parameters and behaviors
- This method returns the sink's current optional
FileRotationvalue directly. - It is more detailed than
rotation_enabled()because it exposes the actual runtime rotation parameters. - A
Noneresult means the sink currently has no rotation policy. - This helper observes current policy state only and does not mutate the sink.
How to Use
Here are some specific examples provided.
When Need Active Rotation Parameters
When support output or runtime checks should show the current direct rotation policy:
let rotation = sink.rotation_config()In this example, callers can inspect the current optional rotation config on the concrete sink.
When Branch On Optional Rotation Presence
When code should behave differently for rotating and non-rotating file sinks:
match sink.rotation_config() {
Some(cfg) => ignore(cfg)
None => ()
}In this example, the optional return shape reflects whether runtime rotation is configured.
Error Case
e.g.:
If callers only need a boolean answer,
rotation_enabled()is the simpler API.This helper does not report whether a past rotation succeeded; use
rotation_failures()orstate()for diagnostics.
Notes
Use this helper when current runtime rotation parameters matter.
It pairs naturally with
set_rotation(...),clear_rotation(), andset_policy(...).