pub struct TmpFS {
mounted: bool,
mount_point: String,
root: RwLock<TmpNode>,
max_memory: usize,
current_memory: Mutex<usize>,
}
Expand description
TmpFS - RAM-only filesystem
Fields§
§mounted: bool
§mount_point: String
§root: RwLock<TmpNode>
Root directory of the filesystem
max_memory: usize
Maximum memory usage in bytes (0 = unlimited)
current_memory: Mutex<usize>
Current memory usage in bytes
Implementations§
Source§impl TmpFS
impl TmpFS
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Get current memory usage
Sourcepub fn memory_limit(&self) -> usize
pub fn memory_limit(&self) -> usize
Get maximum memory limit
Sourcefn check_memory_limit(&self, additional_bytes: usize) -> Result<()>
fn check_memory_limit(&self, additional_bytes: usize) -> Result<()>
Check if memory allocation is allowed
Sourcefn add_memory_usage(&self, bytes: usize)
fn add_memory_usage(&self, bytes: usize)
Add to memory usage counter
Sourcefn subtract_memory_usage(&self, bytes: usize)
fn subtract_memory_usage(&self, bytes: usize)
Subtract from memory usage counter
Sourcefn find_node_mut<F, R>(&self, path: &str, f: F) -> Option<R>where
F: FnOnce(&mut TmpNode) -> R,
fn find_node_mut<F, R>(&self, path: &str, f: F) -> Option<R>where
F: FnOnce(&mut TmpNode) -> R,
Find a mutable reference to a node by path
Sourcefn find_parent_mut<F, R>(&self, path: &str, f: F) -> Result<R>where
F: FnOnce(&mut TmpNode, &str) -> R,
fn find_parent_mut<F, R>(&self, path: &str, f: F) -> Result<R>where
F: FnOnce(&mut TmpNode, &str) -> R,
Find parent node and return mutable reference
Sourcefn normalize_path(&self, path: &str) -> String
fn normalize_path(&self, path: &str) -> String
Normalize path for consistent handling
Trait Implementations§
Source§impl FileOperations for TmpFS
impl FileOperations for TmpFS
Source§fn open(&self, path: &str, _flags: u32) -> Result<Arc<dyn FileHandle>>
fn open(&self, path: &str, _flags: u32) -> Result<Arc<dyn FileHandle>>
Open a file
Source§fn read_dir(&self, path: &str) -> Result<Vec<DirectoryEntry>>
fn read_dir(&self, path: &str) -> Result<Vec<DirectoryEntry>>
Read directory entries
Source§fn create_file(&self, path: &str, file_type: FileType) -> Result<()>
fn create_file(&self, path: &str, file_type: FileType) -> Result<()>
Create a file with the specified type. Read more
Source§fn create_dir(&self, path: &str) -> Result<()>
fn create_dir(&self, path: &str) -> Result<()>
Create a directory
Source§fn metadata(&self, path: &str) -> Result<FileMetadata>
fn metadata(&self, path: &str) -> Result<FileMetadata>
Get the metadata
Auto Trait Implementations§
impl !Freeze for TmpFS
impl !RefUnwindSafe for TmpFS
impl Send for TmpFS
impl Sync for TmpFS
impl Unpin for TmpFS
impl UnwindSafe for TmpFS
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more