Runtime-sink-file-close
Close the file sink behind a RuntimeSink. This helper is the direct file-specific runtime close surface for code that owns a sink value instead of a ConfiguredLogger.
Interface
pub fn RuntimeSink::file_close(self : RuntimeSink) -> Bool {input
self : RuntimeSink- Runtime sink whose file sink should be closed.
output
Bool- Whether the underlying file close succeeded.
Explanation
Detailed rules explaining key parameters and behaviors
- Plain
Fileruntime variants forward directly toFileSink::close(). QueuedFileruntime variants first attemptsink.flush()on the queue wrapper, then callsink.sink.close()on the wrapped file sink.- For
QueuedFile, the queue flush result is ignored and the returnedBoolcomes from the inner file close. - Non-file runtime variants return
false. - After a file-backed runtime sink has already cleared its handle, later
file_close()calls returnfalse.
How to Use
Here are some specific examples provided.
When Need Direct File-specific Runtime Teardown
When code holds a file-backed RuntimeSink directly and should close its file handle explicitly:
ignore(sink.file_close())In this example, file teardown happens through the runtime sink itself.
When Need A File-specific Close Result
When application code wants the direct file close outcome:
let closed = sink.file_close()In this example, the result describes file close behavior rather than generic sink close behavior.
Error Case
e.g.:
If the runtime sink is not file-backed, the method returns
false.If the file handle was already closed earlier through this runtime sink or another facade sharing the same underlying file-backed state, the method returns
false.If callers only need generic sink teardown,
close()is the broader API.
Notes
Prefer this helper when direct runtime code specifically cares about file-backed shutdown.
Queued file sinks flush pending records before closing the file, unlike generic
close().