pub struct FsSnapshot { /* private fields */ }Expand description
A simple representation of a subsection of a file system.
Implementations§
Source§impl FsSnapshot
impl FsSnapshot
Sourcepub fn with_added_file<P: AsRef<Path>>(self, path: P, data: Vec<u8>) -> Self
pub fn with_added_file<P: AsRef<Path>>(self, path: P, data: Vec<u8>) -> Self
Adds the given path to the FsSnapshot as a file with the given
contents, then returns it.
Sourcepub fn with_added_dir<P: AsRef<Path>>(self, path: P) -> Self
pub fn with_added_dir<P: AsRef<Path>>(self, path: P) -> Self
Adds the given path to the FsSnapshot as a file with the given
then returns it.
Sourcepub fn merge_with_filter<F>(&mut self, other: Self, predicate: F)
pub fn merge_with_filter<F>(&mut self, other: Self, predicate: F)
Merges two FsSnapshots together, with a filter applied to the paths.
Sourcepub fn add_file<P: AsRef<Path>>(&mut self, path: P, data: Vec<u8>)
pub fn add_file<P: AsRef<Path>>(&mut self, path: P, data: Vec<u8>)
Adds the provided path as a file with the given contents.
Sourcepub fn remove_file<P: AsRef<Path>>(&mut self, path: P)
pub fn remove_file<P: AsRef<Path>>(&mut self, path: P)
Removes the provided path, as a file.
Sourcepub fn remove_dir<P: AsRef<Path>>(&mut self, path: P)
pub fn remove_dir<P: AsRef<Path>>(&mut self, path: P)
Removes the provided path, as a directory.
Sourcepub fn write_to_vfs<P: AsRef<Path>>(&self, base: P, vfs: &Vfs) -> Result<()>
pub fn write_to_vfs<P: AsRef<Path>>(&self, base: P, vfs: &Vfs) -> Result<()>
Writes the FsSnapshot to the provided VFS, using the provided base
as a root for the other paths in the FsSnapshot.
This includes removals, but makes no effort to minimize work done.
Sourcepub fn added_paths(&self) -> Vec<&Path>
pub fn added_paths(&self) -> Vec<&Path>
Returns a list of paths that would be added by this FsSnapshot.
Sourcepub fn removed_paths(&self) -> Vec<&Path>
pub fn removed_paths(&self) -> Vec<&Path>
Returns a list of paths that would be removed by this FsSnapshot.
Sourcepub fn added_files(&self) -> Vec<&Path>
pub fn added_files(&self) -> Vec<&Path>
Returns a list of file paths that would be added by this FsSnapshot
Sourcepub fn added_dirs(&self) -> Vec<&Path>
pub fn added_dirs(&self) -> Vec<&Path>
Returns a list of directory paths that would be added by this FsSnapshot
Sourcepub fn removed_files(&self) -> Vec<&Path>
pub fn removed_files(&self) -> Vec<&Path>
Returns a list of file paths that would be removed by this FsSnapshot
Sourcepub fn removed_dirs(&self) -> Vec<&Path>
pub fn removed_dirs(&self) -> Vec<&Path>
Returns a list of directory paths that would be removed by this FsSnapshot
Trait Implementations§
Source§impl Default for FsSnapshot
impl Default for FsSnapshot
Source§fn default() -> FsSnapshot
fn default() -> FsSnapshot
Auto Trait Implementations§
impl Freeze for FsSnapshot
impl RefUnwindSafe for FsSnapshot
impl Send for FsSnapshot
impl Sync for FsSnapshot
impl Unpin for FsSnapshot
impl UnsafeUnpin for FsSnapshot
impl UnwindSafe for FsSnapshot
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more