Struct filesystem::FakeFileSystem
source · pub struct FakeFileSystem { /* private fields */ }
Expand description
An in-memory file system.
Implementations
sourceimpl FakeFileSystem
impl FakeFileSystem
Trait Implementations
sourceimpl Clone for FakeFileSystem
impl Clone for FakeFileSystem
sourcefn clone(&self) -> FakeFileSystem
fn clone(&self) -> FakeFileSystem
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for FakeFileSystem
impl Debug for FakeFileSystem
sourceimpl Default for FakeFileSystem
impl Default for FakeFileSystem
sourcefn default() -> FakeFileSystem
fn default() -> FakeFileSystem
Returns the “default value” for a type. Read more
sourceimpl FileSystem for FakeFileSystem
impl FileSystem for FakeFileSystem
type DirEntry = DirEntry
type ReadDir = ReadDir
sourcefn current_dir(&self) -> Result<PathBuf>
fn current_dir(&self) -> Result<PathBuf>
Returns the current working directory.
This is based on
std::env::current_dir
. Read moresourcefn 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
. Read moresourcefn 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.
sourcefn 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.
sourcefn 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
. Read moresourcefn 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
. Read moresourcefn 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
. Read moresourcefn 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
. Read moresourcefn 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
. Read moresourcefn create_file<P, B>(&self, path: P, buf: B) -> Result<()>where
P: AsRef<Path>,
B: AsRef<[u8]>,
fn create_file<P, B>(&self, path: P, buf: B) -> Result<()>where
P: AsRef<Path>,
B: AsRef<[u8]>,
sourcefn write_file<P, B>(&self, path: P, buf: B) -> Result<()>where
P: AsRef<Path>,
B: AsRef<[u8]>,
fn write_file<P, B>(&self, path: P, buf: B) -> Result<()>where
P: AsRef<Path>,
B: AsRef<[u8]>,
Writes
buf
to a new or existing file at buf
.
This will overwrite any contents that already exist. Read moresourcefn overwrite_file<P, B>(&self, path: P, buf: B) -> Result<()>where
P: AsRef<Path>,
B: AsRef<[u8]>,
fn overwrite_file<P, B>(&self, path: P, buf: B) -> Result<()>where
P: AsRef<Path>,
B: AsRef<[u8]>,
Writes
buf
to an existing file at buf
.
This will overwrite any contents that already exist. Read moresourcefn 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 moresourcefn 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 moresourcefn rename<P, Q>(&self, from: P, to: Q) -> Result<()>where
P: AsRef<Path>,
Q: AsRef<Path>,
fn rename<P, Q>(&self, from: P, to: Q) -> Result<()>where
P: AsRef<Path>,
Q: AsRef<Path>,
Renames a file or directory.
If both
from
and to
are files, to
will be replaced.
Based on std::fs::rename
. Read moresourceimpl TempFileSystem for FakeFileSystem
impl TempFileSystem for FakeFileSystem
Auto Trait Implementations
impl RefUnwindSafe for FakeFileSystem
impl Send for FakeFileSystem
impl Sync for FakeFileSystem
impl Unpin for FakeFileSystem
impl UnwindSafe for FakeFileSystem
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more