Skip to main content

OpenFile

Struct OpenFile 

Source
pub struct OpenFile {
    pub path: String,
    pub rel: String,
    pub is_dir: bool,
    pub can_read: bool,
    pub can_write: bool,
    pub delete_on_close: bool,
    pub delete_pending: bool,
    pub inner: Box<dyn Any>,
}
Expand description

An open file or directory handle owned by a backend.

The server tracks common bookkeeping (path, access flags, delete state); backend-private state lives in OpenFile::inner.

Fields§

§path: String

Backend-relative path this handle was opened on (kept in sync across rename-by-handle).

§rel: String

Share-relative client path the handle was opened on (backslashes normalized to \), empty for the share root. Lets protocol layers re-enumerate or re-stat without re-deriving paths from storage.

§is_dir: bool

True when the handle refers to a directory.

§can_read: bool

Read data access was granted at open time.

§can_write: bool

Write/append/delete-data access was granted at open time.

§delete_on_close: bool

Delete-on-close requested via create options.

§delete_pending: bool

Deletion requested through SET_INFORMATION; applied on close.

§inner: Box<dyn Any>

Opaque backend state (file descriptor wrapper, cached cursor, …).

Not Send/Sync: io_uring resources (tokio_uring::fs::File) are !Send, and per-connection state is driven entirely on one thread.

Implementations§

Source§

impl OpenFile

Source

pub fn inner_as<T: 'static>(&self) -> Option<&T>

Downcast the backend-private state to a concrete type.

Source

pub fn inner_as_ref<T: 'static>(&self) -> Option<&T>

Immutably downcast the backend-private state (alias of Self::inner_as).

Source

pub fn inner_as_mut<T: 'static>(&mut self) -> Option<&mut T>

Mutably downcast the backend-private state to a concrete type.

Trait Implementations§

Source§

impl Debug for OpenFile

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.