pub struct InMemoryFs { /* private fields */ }Expand description
A fully in-memory filesystem implementation.
Thread-safe via Arc<RwLock<...>> — all VirtualFs methods take &self.
Cloning is cheap (Arc increment) which is useful for subshell state cloning.
Implementations§
Source§impl InMemoryFs
impl InMemoryFs
pub fn new() -> Self
Sourcepub fn deep_clone(&self) -> Self
pub fn deep_clone(&self) -> Self
Create a completely independent copy of this filesystem.
Unlike Clone (which shares data via Arc), this recursively clones
the entire FsNode tree so the copy and original are fully independent.
Used for subshell isolation: ( cmds ).
Trait Implementations§
Source§impl Clone for InMemoryFs
impl Clone for InMemoryFs
Source§fn clone(&self) -> InMemoryFs
fn clone(&self) -> InMemoryFs
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InMemoryFs
impl Debug for InMemoryFs
Source§impl Default for InMemoryFs
impl Default for InMemoryFs
Source§impl VirtualFs for InMemoryFs
impl VirtualFs for InMemoryFs
fn read_file(&self, path: &Path) -> Result<Vec<u8>, VfsError>
fn write_file(&self, path: &Path, content: &[u8]) -> Result<(), VfsError>
fn append_file(&self, path: &Path, content: &[u8]) -> Result<(), VfsError>
fn remove_file(&self, path: &Path) -> Result<(), VfsError>
fn mkdir(&self, path: &Path) -> Result<(), VfsError>
fn mkdir_p(&self, path: &Path) -> Result<(), VfsError>
fn readdir(&self, path: &Path) -> Result<Vec<DirEntry>, VfsError>
fn remove_dir(&self, path: &Path) -> Result<(), VfsError>
fn remove_dir_all(&self, path: &Path) -> Result<(), VfsError>
fn exists(&self, path: &Path) -> bool
fn stat(&self, path: &Path) -> Result<Metadata, VfsError>
fn lstat(&self, path: &Path) -> Result<Metadata, VfsError>
fn chmod(&self, path: &Path, mode: u32) -> Result<(), VfsError>
fn utimes(&self, path: &Path, mtime: SystemTime) -> Result<(), VfsError>
fn symlink(&self, target: &Path, link: &Path) -> Result<(), VfsError>
fn hardlink(&self, src: &Path, dst: &Path) -> Result<(), VfsError>
fn readlink(&self, path: &Path) -> Result<PathBuf, VfsError>
fn canonicalize(&self, path: &Path) -> Result<PathBuf, VfsError>
fn copy(&self, src: &Path, dst: &Path) -> Result<(), VfsError>
fn rename(&self, src: &Path, dst: &Path) -> Result<(), VfsError>
fn glob(&self, pattern: &str, cwd: &Path) -> Result<Vec<PathBuf>, VfsError>
Auto Trait Implementations§
impl Freeze for InMemoryFs
impl !RefUnwindSafe for InMemoryFs
impl Send for InMemoryFs
impl Sync for InMemoryFs
impl Unpin for InMemoryFs
impl UnsafeUnpin for InMemoryFs
impl !UnwindSafe for InMemoryFs
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