pub struct FakeFileSystem { /* private fields */ }
Expand description
An in-memory file system.
Implementations§
Trait Implementations§
Source§impl Clone for FakeFileSystem
impl Clone for FakeFileSystem
Source§fn clone(&self) -> FakeFileSystem
fn clone(&self) -> FakeFileSystem
Returns a copy 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 FakeFileSystem
impl Debug for FakeFileSystem
Source§impl Default for FakeFileSystem
impl Default for FakeFileSystem
Source§fn default() -> FakeFileSystem
fn default() -> FakeFileSystem
Returns the “default value” for a type. Read more
Source§impl FileSystem for FakeFileSystem
impl FileSystem for FakeFileSystem
type DirEntry = DirEntry
type ReadDir = ReadDir
Source§fn current_dir(&self) -> Result<PathBuf>
fn current_dir(&self) -> Result<PathBuf>
Returns the current working directory.
This is based on
std::env::current_dir
.Source§fn set_current_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
fn set_current_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
Updates the current working directory.
This is based on
std::env::set_current_dir
.Source§fn is_dir<P: AsRef<Path>>(&self, path: P) -> bool
fn is_dir<P: AsRef<Path>>(&self, path: P) -> bool
Determines whether the path exists and points to a directory.
Source§fn is_file<P: AsRef<Path>>(&self, path: P) -> bool
fn is_file<P: AsRef<Path>>(&self, path: P) -> bool
Determines whether the path exists and points to a file.
Source§fn create_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
fn create_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
Creates a new directory.
This is based on
std::fs::create_dir
.Source§fn create_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>
fn create_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>
Recursively creates a directory and any missing parents.
This is based on
std::fs::create_dir
.Source§fn remove_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
fn remove_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
Removes an empty directory.
This is based on
std::fs::remove_dir
.Source§fn remove_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>
fn remove_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>
Removes a directory and any child files or directories.
This is based on
std::fs::remove_dir_all
.Source§fn read_dir<P: AsRef<Path>>(&self, path: P) -> Result<Self::ReadDir>
fn read_dir<P: AsRef<Path>>(&self, path: P) -> Result<Self::ReadDir>
Returns an iterator over the entries in a directory.
This is based on
std::fs::read_dir
.Source§fn create_file<P, B>(&self, path: P, buf: B) -> Result<()>
fn create_file<P, B>(&self, path: P, buf: B) -> Result<()>
Source§fn write_file<P, B>(&self, path: P, buf: B) -> Result<()>
fn write_file<P, B>(&self, path: P, buf: B) -> Result<()>
Writes
buf
to a new or existing file at buf
.
This will overwrite any contents that already exist. Read moreSource§fn overwrite_file<P, B>(&self, path: P, buf: B) -> Result<()>
fn overwrite_file<P, B>(&self, path: P, buf: B) -> Result<()>
Writes
buf
to an existing file at buf
.
This will overwrite any contents that already exist. Read moreSource§fn read_file<P: AsRef<Path>>(&self, path: P) -> Result<Vec<u8>>
fn read_file<P: AsRef<Path>>(&self, path: P) -> Result<Vec<u8>>
Returns the contents of
path
. Read moreSource§fn read_file_to_string<P: AsRef<Path>>(&self, path: P) -> Result<String>
fn read_file_to_string<P: AsRef<Path>>(&self, path: P) -> Result<String>
Returns the contents of
path
as a string. Read moreSource§fn read_file_into<P, B>(&self, path: P, buf: B) -> Result<usize>
fn read_file_into<P, B>(&self, path: P, buf: B) -> Result<usize>
Writes the contents of
path
into the buffer. If successful, returns
the number of bytes that were read. Read moreSource§fn remove_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
fn remove_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
Removes the file at
path
.
This is based on std::fs::remove_file
.Source§fn rename<P, Q>(&self, from: P, to: Q) -> Result<()>
fn rename<P, Q>(&self, from: P, to: Q) -> Result<()>
Renames a file or directory.
If both
from
and to
are files, to
will be replaced.
Based on std::fs::rename
.Source§impl TempFileSystem for FakeFileSystem
impl TempFileSystem for FakeFileSystem
Source§impl UnixFileSystem for FakeFileSystem
impl UnixFileSystem for FakeFileSystem
Source§fn mode<P: AsRef<Path>>(&self, path: P) -> Result<u32>
fn mode<P: AsRef<Path>>(&self, path: P) -> Result<u32>
Returns the current mode bits of
path
. Read moreSource§fn set_mode<P: AsRef<Path>>(&self, path: P, mode: u32) -> Result<()>
fn set_mode<P: AsRef<Path>>(&self, path: P, mode: u32) -> Result<()>
Sets the mode bits of
path
. Read moreAuto Trait Implementations§
impl Freeze for FakeFileSystem
impl RefUnwindSafe for FakeFileSystem
impl Send for FakeFileSystem
impl Sync for FakeFileSystem
impl Unpin for FakeFileSystem
impl UnwindSafe for FakeFileSystem
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