pub struct VirtualFilesystem { /* private fields */ }Expand description
An in-memory virtual filesystem for use in tests and sandboxed execution.
Implementations§
Source§impl VirtualFilesystem
impl VirtualFilesystem
Sourcepub fn set_read_only(&mut self, ro: bool)
pub fn set_read_only(&mut self, ro: bool)
Mark the filesystem as read-only.
Sourcepub fn delete_file(&mut self, path: &str) -> bool
pub fn delete_file(&mut self, path: &str) -> bool
Delete a file.
Sourcepub fn file_exists(&self, path: &str) -> bool
pub fn file_exists(&self, path: &str) -> bool
Check whether a file exists.
Sourcepub fn dir_exists(&self, path: &str) -> bool
pub fn dir_exists(&self, path: &str) -> bool
Check whether a directory exists.
Sourcepub fn append_file(
&mut self,
path: &str,
contents: &[u8],
) -> Result<(), IoError>
pub fn append_file( &mut self, path: &str, contents: &[u8], ) -> Result<(), IoError>
Append to a file (creating it if it doesn’t exist).
Sourcepub fn file_count(&self) -> usize
pub fn file_count(&self) -> usize
Total number of files.
Sourcepub fn total_bytes(&self) -> usize
pub fn total_bytes(&self) -> usize
Total bytes stored.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VirtualFilesystem
impl RefUnwindSafe for VirtualFilesystem
impl Send for VirtualFilesystem
impl Sync for VirtualFilesystem
impl Unpin for VirtualFilesystem
impl UnsafeUnpin for VirtualFilesystem
impl UnwindSafe for VirtualFilesystem
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