File-sink-default-policy
Read the initial default file policy captured by a FileSink. This helper exposes the baseline file policy recorded when the sink was created.
Interface
pub fn FileSink::default_policy(self : FileSink) -> FileSinkPolicy {input
self : FileSink- File sink whose default file policy should be inspected.
output
FileSinkPolicy- Initial default file policy.
Explanation
Detailed rules explaining key parameters and behaviors
- The returned policy is built from the sink's stored default append, auto-flush, and rotation values.
- This helper is useful when callers need to compare runtime drift or restore defaults later.
- It is observation-only and does not mutate sink state.
How to Use
Here are some specific examples provided.
When Need Baseline Policy Visibility
When diagnostics should show the original file policy separately from the live one:
let defaults = sink.default_policy()In this example, the direct file sink exposes its original file policy snapshot.
When Prepare For Policy Reset Logic
When tooling should capture or compare default settings explicitly:
let original = sink.default_policy()In this example, callers can reason about factory policy separately from runtime changes.
Error Case
e.g.:
If callers only need to know whether runtime drift exists,
policy_matches_default()is the simpler API.This helper does not say whether the current sink handle is available.
Notes
Use this helper when the original file policy matters operationally.
It complements
policy()andreset_policy().