pub struct MemoryFs { /* private fields */ }Expand description
In-memory filesystem.
Thread-safe via internal RwLock. All data is lost when dropped.
Tracks its resident content bytes exactly (net: an overwrite charges the
delta, a remove credits) and optionally draws them from a shared
ByteBudget.
Implementations§
Trait Implementations§
Source§impl Drop for MemoryFs
Credit resident content bytes back to the shared budget when the
filesystem is dropped. Without this, dropping a budgeted MemoryFs (e.g.
the upper inside a dropped over_with_budget overlay, or a fork’s fresh
upper) strands its charge: repeated create-then-drop cycles drain the
shared ByteBudget toward spurious StorageFull with zero actual RAM
held. Mirrors OverlayFs’s drop of its base-snapshot bytes.
impl Drop for MemoryFs
Credit resident content bytes back to the shared budget when the
filesystem is dropped. Without this, dropping a budgeted MemoryFs (e.g.
the upper inside a dropped over_with_budget overlay, or a fork’s fresh
upper) strands its charge: repeated create-then-drop cycles drain the
shared ByteBudget toward spurious StorageFull with zero actual RAM
held. Mirrors OverlayFs’s drop of its base-snapshot bytes.
Source§impl Filesystem for MemoryFs
impl Filesystem for MemoryFs
Source§fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
Read the entire contents of a file.
Source§fn write<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
MemoryFs: 'async_trait,
fn write<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
MemoryFs: 'async_trait,
Write data to a file, creating it if it doesn’t exist. Read more
Source§fn set_mtime<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
mtime: SystemTime,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
fn set_mtime<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
mtime: SystemTime,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
Set the modification time of an existing path. Read more
Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
List entries in a directory.
Source§fn stat<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<DirEntry, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
fn stat<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<DirEntry, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
Get metadata for a file or directory.
Source§fn lstat<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<DirEntry, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
fn lstat<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<DirEntry, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
Get metadata for a path without following symlinks. Read more
Source§fn read_link<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<PathBuf, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
fn read_link<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<PathBuf, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
Read the target of a symbolic link without following it. Read more
Source§fn symlink<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 Path,
link: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
MemoryFs: 'async_trait,
fn symlink<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 Path,
link: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
MemoryFs: 'async_trait,
Create a symbolic link. Read more
Source§fn mkdir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
fn mkdir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
Create a directory (and parent directories if needed). Read more
Source§fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryFs: 'async_trait,
Remove a file or empty directory. Read more
Source§fn rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from: &'life1 Path,
to: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
MemoryFs: 'async_trait,
fn rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from: &'life1 Path,
to: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
MemoryFs: 'async_trait,
Rename (move) a file or directory. Read more
Source§fn resident_bytes(&self) -> Option<u64>
fn resident_bytes(&self) -> Option<u64>
Memory-resident content bytes this filesystem is holding, if it
tracks them. Read more
Auto Trait Implementations§
impl !Freeze for MemoryFs
impl !RefUnwindSafe for MemoryFs
impl Send for MemoryFs
impl Sync for MemoryFs
impl Unpin for MemoryFs
impl UnsafeUnpin for MemoryFs
impl UnwindSafe for MemoryFs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more