pub struct FileProjection { /* private fields */ }Expand description
A utility struct for holding a set of paths, and all children from those paths. Contains an associated set of “exclude” paths whose children should not be returned.
Implementations§
Source§impl FileProjection
impl FileProjection
Sourcepub fn new(
src_paths: impl IntoIterator<Item = impl AsRef<Path>>,
excl_paths: impl IntoIterator<Item = impl AsRef<Path>>,
excl_exts: impl IntoIterator<Item = impl AsRef<OsStr>>,
) -> Result<Self, FileProjectionError>
pub fn new( src_paths: impl IntoIterator<Item = impl AsRef<Path>>, excl_paths: impl IntoIterator<Item = impl AsRef<Path>>, excl_exts: impl IntoIterator<Item = impl AsRef<OsStr>>, ) -> Result<Self, FileProjectionError>
Create a new FileProjection with the given src_paths, excl_paths and ignore-extensions Child files can either be got by projecting the src_paths, either from the filesystem (project_using_fs), or from some list (project_using_list). Once projection has occurred the projected files will be cached by this struct (This feature is mostly to avoid having to visit the filesystem more than once when performing large projections)
Projected files can be retrieved by calling projected_files
Sourcepub fn contains(&self, src_path: impl AsRef<Path>) -> bool
pub fn contains(&self, src_path: impl AsRef<Path>) -> bool
Returns true if the given path is a child of any src_path, and is not a child of any excl_path.
Sourcepub fn project_using_fs(&mut self) -> Result<Vec<Error>, FileProjectionError>
pub fn project_using_fs(&mut self) -> Result<Vec<Error>, FileProjectionError>
Visit the filesystem to get all child files which are a child of any of Self::src_paths, and which are not a child of Self::excl_paths.
§Return values
Returns Err() if any path in Self::src_paths or Self::excl_paths cannot be read from the filesystem.
Otherwise returns Ok() containing a list of all other errors encountered while retrieving paths from the filesystem.
§Panics
This function will panic if either project_using_fs or project_using_list has already been called.
Sourcepub fn project_using_list(
&mut self,
list: impl IntoIterator<Item = impl AsRef<Path>>,
)
pub fn project_using_list( &mut self, list: impl IntoIterator<Item = impl AsRef<Path>>, )
Enumerate files by filtering a list of paths.
§Panics
This function will panic if either project_using_fs or project_using_list has already been called.
Sourcepub fn projected_files(&self) -> &HashSet<PathBuf>
pub fn projected_files(&self) -> &HashSet<PathBuf>
Obtain the set of all enumerated files. File enumeration must have already taken place.
§Panics
This function will panic if enumeration has not occurred.
Trait Implementations§
Source§impl Clone for FileProjection
impl Clone for FileProjection
Source§fn clone(&self) -> FileProjection
fn clone(&self) -> FileProjection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for FileProjection
impl RefUnwindSafe for FileProjection
impl Send for FileProjection
impl Sync for FileProjection
impl Unpin for FileProjection
impl UnwindSafe for FileProjection
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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