Skip to main content

MemoryFilesystem

Struct MemoryFilesystem 

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

Pure Rust, deterministic byte-path filesystem. Paths are exact opaque keys, including NUL and invalid UTF-8; no directories or OS normalization exist. Open files survive remove/rename. Temporary handles are anonymous and drop their storage on close; temporary names reserve visible empty entries. Clones share files/resources; preserve this object across snapshot restore.

Implementations§

Source§

impl MemoryFilesystem

Source

pub fn new( files: impl IntoIterator<Item = (Vec<u8>, Vec<u8>)>, options: MemoryOptions, ) -> Result<Self, HostIoError>

Seed initial files, bypassing read-only policy but enforcing file-size limits. Duplicate paths take the last supplied value.

Source

pub fn contents(&self, path: &[u8]) -> Option<Vec<u8>>

Copy a named file without acquiring a handle; useful for reference fixtures.

Source

pub fn open_count(&self) -> usize

Count live handles (temporary handles included).

Trait Implementations§

Source§

impl Clone for MemoryFilesystem

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Filesystem for MemoryFilesystem

Source§

fn probe_readable(&self, path: &[u8]) -> Completion<bool>

Perform probe_readable; return final success/failure or an opaque pending token.
Source§

fn open(&self, path: &[u8], mode: OpenMode) -> Completion<ResourceId>

Perform open; return final success/failure or an opaque pending token.
Source§

fn read_at( &self, id: ResourceId, offset: u64, max: usize, ) -> Completion<Vec<u8>>

Perform read_at; return final success/failure or an opaque pending token.
Source§

fn write_at( &self, id: ResourceId, offset: u64, bytes: &[u8], ) -> Completion<usize>

Perform write_at; return final success/failure or an opaque pending token.
Source§

fn append(&self, id: ResourceId, bytes: &[u8]) -> Completion<u64>

Perform append; return final success/failure or an opaque pending token.
Source§

fn size(&self, id: ResourceId) -> Completion<u64>

Perform size; return final success/failure or an opaque pending token.
Source§

fn flush(&self, id: ResourceId) -> Completion<()>

Perform flush; return final success/failure or an opaque pending token.
Source§

fn close(&self, id: ResourceId) -> Completion<()>

Perform close; return final success/failure or an opaque pending token.
Source§

fn remove(&self, path: &[u8]) -> Completion<()>

Perform remove; return final success/failure or an opaque pending token.
Source§

fn rename(&self, from: &[u8], to: &[u8]) -> Completion<()>

Perform rename; return final success/failure or an opaque pending token.
Source§

fn temp_file(&self) -> Completion<ResourceId>

Perform temp_file; return final success/failure or an opaque pending token.
Source§

fn temp_name(&self) -> Completion<Vec<u8>>

Perform temp_name; return final success/failure or an opaque pending token.
Source§

fn read_file(&self, path: &[u8], max: usize) -> Completion<Vec<u8>>

Perform read_file; return final success/failure or an opaque pending token.
Source§

fn read_file_range( &self, path: &[u8], offset: u64, max: usize, ) -> Completion<Vec<u8>>

Read a bounded range of a named file without retaining a live resource. Used by checkpointable source loading. Short results indicate EOF. The default supports only a whole file fitting in the first request.
Source§

fn handle_policy(&self) -> HandlePolicy

Snapshot policy for live resource keys.
Source§

fn rebind(&self, id: ResourceId) -> Result<(), HostIoError>

Reacquire an existing resource without creating, truncating or changing it.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.