pub trait FileHandle {
// Required methods
fn path(&self) -> &Path;
fn try_close(&mut self) -> Result<(), VfError>;
fn is_closed(&self) -> bool;
fn close(self) -> Result<(), VfError>
where Self: Sized;
}Expand description
Owned handle to one open file instance.
A descriptor is the handle to the instance; this contract does not require
exposing a numeric OS descriptor. crate::Fd is a backend-assigned numeric
slot, while implementations such as vfsi_sync::OpenFile own cleanup.
This is neither an underlying filesystem-object ID nor a protocol filehandle such as an NFS filehandle. Separate opens of the same object yield separate instances. Borrowed requests preserve the instance’s lifetime; clients validate connection ownership before dispatch.
Clients validate ownership before I/O and report positional progress.
Standard-I/O adapters manage their own independent cursors. ReadOp borrows handles directly; constructing it does no I/O.
A backend must retain ownership of live descriptors through cleanup failures.
Required Methods§
Sourcefn try_close(&mut self) -> Result<(), VfError>
fn try_close(&mut self) -> Result<(), VfError>
Close without surrendering cleanup ownership on failure. After an ambiguous failure, reconcile/close rather than resume ordinary I/O.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".