Skip to main content

MemFs

Struct MemFs 

Source
pub struct MemFs { /* private fields */ }
Expand description

An in-memory filesystem.

Implementations§

Source§

impl MemFs

Source

pub fn new() -> Self

Create a new in-memory filesystem with an empty root directory.

Trait Implementations§

Source§

impl Default for MemFs

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl NfsFileSystem for MemFs

Source§

fn stat<'life0, 'async_trait>( &'life0 self, id: FileId, ) -> Pin<Box<dyn Future<Output = NfsResult<NodeInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return minimal information about an object.
Source§

fn lookup<'life0, 'life1, 'async_trait>( &'life0 self, dir_id: FileId, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = NfsResult<FileId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Look up a child entry by name in a directory.
Source§

fn lookup_parent<'life0, 'async_trait>( &'life0 self, id: FileId, ) -> Pin<Box<dyn Future<Output = NfsResult<FileId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Look up the parent of an object.
Source§

fn readdir<'life0, 'async_trait>( &'life0 self, dir_id: FileId, ) -> Pin<Box<dyn Future<Output = NfsResult<Vec<DirEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List a directory’s entries. Read more
Source§

fn read<'life0, 'async_trait>( &'life0 self, id: FileId, offset: u64, count: u32, ) -> Pin<Box<dyn Future<Output = NfsResult<(Vec<u8>, bool)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read file data.
Source§

fn write<'life0, 'life1, 'async_trait>( &'life0 self, id: FileId, offset: u64, data: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = NfsResult<u32>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write file data. Returns bytes written.
Source§

fn truncate<'life0, 'async_trait>( &'life0 self, id: FileId, size: u64, ) -> Pin<Box<dyn Future<Output = NfsResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Truncate or extend a file to the given size.
Source§

fn create_file<'life0, 'life1, 'async_trait>( &'life0 self, dir_id: FileId, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = NfsResult<FileId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a regular file and return its FileId.
Source§

fn create_dir<'life0, 'life1, 'async_trait>( &'life0 self, dir_id: FileId, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = NfsResult<FileId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a directory and return its FileId.
Source§

fn remove<'life0, 'life1, 'async_trait>( &'life0 self, dir_id: FileId, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = NfsResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a file or empty directory by name.
Source§

fn rename<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from_dir: FileId, from_name: &'life1 str, to_dir: FileId, to_name: &'life2 str, ) -> Pin<Box<dyn Future<Output = NfsResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Rename or move an entry.
Optional symlink capability.
Optional hard-link capability.
Source§

fn named_attrs(&self) -> Option<&dyn NfsNamedAttrs>

Optional named-attribute capability.
Source§

fn syncer(&self) -> Option<&dyn NfsSync>

Optional explicit flush capability.
Source§

fn root(&self) -> FileId

Return the root object ID. The default root is 1.
Source§

fn fs_info(&self) -> FsInfo

Filesystem-level information.
Create a hard link to an existing file.
Source§

impl NfsNamedAttrs for MemFs

Source§

fn list_xattrs<'life0, 'async_trait>( &'life0 self, id: FileId, ) -> Pin<Box<dyn Future<Output = NfsResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all named attributes attached to an object.
Source§

fn get_xattr<'life0, 'life1, 'async_trait>( &'life0 self, id: FileId, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = NfsResult<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch a full named-attribute value.
Source§

fn set_xattr<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: FileId, name: &'life1 str, value: &'life2 [u8], mode: XattrSetMode, ) -> Pin<Box<dyn Future<Output = NfsResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Set or replace a named-attribute value.
Source§

fn remove_xattr<'life0, 'life1, 'async_trait>( &'life0 self, id: FileId, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = NfsResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a named attribute.
Create a symlink in a directory and return its FileId.
Read a symlink target.
Source§

impl NfsSync for MemFs

Source§

fn commit<'life0, 'async_trait>( &'life0 self, _id: FileId, ) -> Pin<Box<dyn Future<Output = NfsResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Flush any buffered data for a file.

Auto Trait Implementations§

§

impl !Freeze for MemFs

§

impl !RefUnwindSafe for MemFs

§

impl Send for MemFs

§

impl Sync for MemFs

§

impl Unpin for MemFs

§

impl UnsafeUnpin for MemFs

§

impl !UnwindSafe for MemFs

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more