Skip to main content

FsFile

Struct FsFile 

Source
pub struct FsFile<F: HandleBackend> { /* private fields */ }
Expand description

Owned RAII file which does not borrow the client.

File operations use the owning client’s Vfsi implementation. Dropping an open file queues cleanup without waiting for the backend lock. Dropping the final connection owner can perform synchronous teardown. Use try_close when the close result matters.

Implementations§

Source§

impl<F: HandleBackend> FsFile<F>

Source

pub fn is_closed(&self) -> bool

Whether explicit close has completed successfully on this handle.

Source

pub fn read_request_at(&self, offset: u64, length: usize) -> FsRead<'_, F>

Source

pub fn path(&self) -> &Path

Name used at open, retained for diagnostics; not a current namespace lookup or proof of identity. Handle operations continue to use the opened object even if its pathname changes.

Source

pub fn write_request_at<'a>( &'a self, offset: u64, data: &'a [u8], ) -> FsWrite<'a, F>

Source

pub fn read_request_at_into<'a>( &'a self, offset: u64, buffer: &'a mut [u8], ) -> FsReadInto<'a, F>

Source

pub fn try_close(&mut self) -> VfResult<()>

Attempt to close without consuming the handle. A failed close leaves the handle armed so the caller can reconcile or retry cleanup explicitly. After an ambiguous close failure, remote state is unknown: do not resume data I/O just because is_closed() is false. This is local ownership, not proof that the server still has the descriptor open.

Source

pub fn close(self) -> VfResult<()>

Consume and close the handle. On failure, Drop queues cleanup for a later operation or explicit cleanup drain; use try_close to retain control.

Trait Implementations§

Source§

impl<F: HandleBackend> Debug for FsFile<F>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F: HandleBackend> Drop for FsFile<F>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<F: HandleBackend> FileHandle for FsFile<F>

Source§

fn path(&self) -> &Path

Diagnostic name captured at open; not current path or object identity.
Source§

fn try_close(&mut self) -> Result<()>

Close without surrendering cleanup ownership on failure. After an ambiguous failure, reconcile/close rather than resume ordinary I/O.
Source§

fn is_closed(&self) -> bool

Local close ownership only, not proof of remote liveness after failure.
Source§

fn close(self) -> Result<()>

Consuming close: on failure the handle is lost and Drop retries cleanup best-effort on a later operation or cleanup drain. Prefer try_close when cleanup failures need reconciliation.

Auto Trait Implementations§

§

impl<F> Freeze for FsFile<F>
where Arc<SharedBackend<F>>: Freeze,

§

impl<F> RefUnwindSafe for FsFile<F>
where Arc<SharedBackend<F>>: RefUnwindSafe,

§

impl<F> Send for FsFile<F>
where Arc<SharedBackend<F>>: Send,

§

impl<F> Sync for FsFile<F>
where Arc<SharedBackend<F>>: Sync,

§

impl<F> Unpin for FsFile<F>
where Arc<SharedBackend<F>>: Unpin,

§

impl<F> UnsafeUnpin for FsFile<F>
where Arc<SharedBackend<F>>: UnsafeUnpin,

§

impl<F> UnwindSafe for FsFile<F>
where Arc<SharedBackend<F>>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.