Enum build_fs_tree::FileSystemTree
source · pub enum FileSystemTree<Path, FileContent>where
Path: Ord,{
File(FileContent),
Directory(BTreeMap<Path, Self>),
}
Expand description
Representation of a filesystem which contains only files and directories.
The serialization of FileContent
(content of file) and BTreeMap<Path, Self>
(children of directory) must not share the same type. That is, FileContent
must
be serialized to things other than a dictionary.
Note: FileSystemTree::build
cannot write over an existing
directory. Use MergeableFileSystemTree
instead if you desire such behavior.
Generic parameters:
Path
: Reference to a file in the filesystem.FileContent
: Content of a file.
Variants§
File(FileContent)
Represents a file with its content.
Its YAML representation must not have the same type as FileSystemTree::Directory
’s.
Directory(BTreeMap<Path, Self>)
Represents a directory with its children.
It is a set of name-to-subtree mappings.
Its YAML representation must not have the same type as FileSystemTree::File
’s.
Implementations§
source§impl<Path, FileContent> FileSystemTree<Path, FileContent>where
Path: Ord,
impl<Path, FileContent> FileSystemTree<Path, FileContent>where Path: Ord,
sourcepub fn file_content(&self) -> Option<&FileContent>
pub fn file_content(&self) -> Option<&FileContent>
Get immutable reference to the file content.
sourcepub fn dir_content(&self) -> Option<&BTreeMap<Path, Self>>
pub fn dir_content(&self) -> Option<&BTreeMap<Path, Self>>
Get immutable reference to the directory content.
sourcepub fn path<'a>(
&'a self,
path: &'a mut impl Iterator<Item = &'a Path>
) -> Option<&'a Self>
pub fn path<'a>( &'a self, path: &'a mut impl Iterator<Item = &'a Path> ) -> Option<&'a Self>
Get immutable reference to a descendant of any level.
sourcepub fn file_content_mut(&mut self) -> Option<&mut FileContent>
pub fn file_content_mut(&mut self) -> Option<&mut FileContent>
Get mutable reference to the file content.
sourcepub fn dir_content_mut(&mut self) -> Option<&mut BTreeMap<Path, Self>>
pub fn dir_content_mut(&mut self) -> Option<&mut BTreeMap<Path, Self>>
Get mutable reference to the directory content.
Trait Implementations§
source§impl<Path, FileContent> AsMut<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent>where
Path: Ord,
impl<Path, FileContent> AsMut<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent>where Path: Ord,
source§fn as_mut(&mut self) -> &mut FileSystemTree<Path, FileContent>
fn as_mut(&mut self) -> &mut FileSystemTree<Path, FileContent>
source§impl<Path, FileContent> AsRef<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent>where
Path: Ord,
impl<Path, FileContent> AsRef<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent>where Path: Ord,
source§fn as_ref(&self) -> &FileSystemTree<Path, FileContent>
fn as_ref(&self) -> &FileSystemTree<Path, FileContent>
source§impl<Name, FileContent> Build<Name, Error> for FileSystemTree<Name, FileContent>where
Name: AsRef<Path> + Ord,
FileContent: AsRef<[u8]>,
impl<Name, FileContent> Build<Name, Error> for FileSystemTree<Name, FileContent>where Name: AsRef<Path> + Ord, FileContent: AsRef<[u8]>,
§type BorrowedPath = Path
type BorrowedPath = Path
source§fn join(prefix: &Self::BorrowedPath, name: &Name) -> Self::OwnedPath
fn join(prefix: &Self::BorrowedPath, name: &Name) -> Self::OwnedPath
source§fn write_file(
path: &Self::BorrowedPath,
content: &Self::FileContent
) -> Result<(), Error>
fn write_file( path: &Self::BorrowedPath, content: &Self::FileContent ) -> Result<(), Error>
source§fn create_dir(path: &Self::BorrowedPath) -> Result<(), Error>
fn create_dir(path: &Self::BorrowedPath) -> Result<(), Error>
source§fn build<Path>(
self,
path: Path
) -> Result<(), BuildError<Self::OwnedPath, Error>>where
Path: AsRef<Self::BorrowedPath>,
fn build<Path>( self, path: Path ) -> Result<(), BuildError<Self::OwnedPath, Error>>where Path: AsRef<Self::BorrowedPath>,
source§impl<Path, FileContent: Clone> Clone for FileSystemTree<Path, FileContent>where
Path: Ord + Clone,
impl<Path, FileContent: Clone> Clone for FileSystemTree<Path, FileContent>where Path: Ord + Clone,
source§fn clone(&self) -> FileSystemTree<Path, FileContent>
fn clone(&self) -> FileSystemTree<Path, FileContent>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<Path, FileContent: Debug> Debug for FileSystemTree<Path, FileContent>where
Path: Ord + Debug,
impl<Path, FileContent: Debug> Debug for FileSystemTree<Path, FileContent>where Path: Ord + Debug,
source§impl<'de, Path, FileContent> Deserialize<'de> for FileSystemTree<Path, FileContent>where
Path: Ord + Deserialize<'de>,
FileContent: Deserialize<'de>,
impl<'de, Path, FileContent> Deserialize<'de> for FileSystemTree<Path, FileContent>where Path: Ord + Deserialize<'de>, FileContent: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl<Path, FileContent> From<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent>where
Path: Ord,
impl<Path, FileContent> From<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent>where Path: Ord,
source§fn from(
original: FileSystemTree<Path, FileContent>
) -> MergeableFileSystemTree<Path, FileContent>
fn from( original: FileSystemTree<Path, FileContent> ) -> MergeableFileSystemTree<Path, FileContent>
source§impl<Path, FileContent> From<MergeableFileSystemTree<Path, FileContent>> for FileSystemTree<Path, FileContent>where
Path: Ord,
impl<Path, FileContent> From<MergeableFileSystemTree<Path, FileContent>> for FileSystemTree<Path, FileContent>where Path: Ord,
source§fn from(original: MergeableFileSystemTree<Path, FileContent>) -> Self
fn from(original: MergeableFileSystemTree<Path, FileContent>) -> Self
source§impl<Path, FileContent> Node for FileSystemTree<Path, FileContent>where
Path: Ord,
impl<Path, FileContent> Node for FileSystemTree<Path, FileContent>where Path: Ord,
§type FileContent = FileContent
type FileContent = FileContent
§type DirectoryContent = BTreeMap<Path, FileSystemTree<Path, FileContent>, Global>
type DirectoryContent = BTreeMap<Path, FileSystemTree<Path, FileContent>, Global>
source§fn read(self) -> NodeContent<FileContent, Self::DirectoryContent>
fn read(self) -> NodeContent<FileContent, Self::DirectoryContent>
source§impl<Path, FileContent: PartialEq> PartialEq<FileSystemTree<Path, FileContent>> for FileSystemTree<Path, FileContent>where
Path: Ord + PartialEq,
impl<Path, FileContent: PartialEq> PartialEq<FileSystemTree<Path, FileContent>> for FileSystemTree<Path, FileContent>where Path: Ord + PartialEq,
source§fn eq(&self, other: &FileSystemTree<Path, FileContent>) -> bool
fn eq(&self, other: &FileSystemTree<Path, FileContent>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<Path, FileContent> Serialize for FileSystemTree<Path, FileContent>where
Path: Ord + Serialize,
FileContent: Serialize,
impl<Path, FileContent> Serialize for FileSystemTree<Path, FileContent>where Path: Ord + Serialize, FileContent: Serialize,
impl<Path, FileContent: Eq> Eq for FileSystemTree<Path, FileContent>where Path: Ord + Eq,
impl<Path, FileContent> StructuralEq for FileSystemTree<Path, FileContent>where Path: Ord,
impl<Path, FileContent> StructuralPartialEq for FileSystemTree<Path, FileContent>where Path: Ord,
Auto Trait Implementations§
impl<Path, FileContent> RefUnwindSafe for FileSystemTree<Path, FileContent>where FileContent: RefUnwindSafe, Path: RefUnwindSafe,
impl<Path, FileContent> Send for FileSystemTree<Path, FileContent>where FileContent: Send, Path: Send,
impl<Path, FileContent> Sync for FileSystemTree<Path, FileContent>where FileContent: Sync, Path: Sync,
impl<Path, FileContent> Unpin for FileSystemTree<Path, FileContent>where FileContent: Unpin,
impl<Path, FileContent> UnwindSafe for FileSystemTree<Path, FileContent>where FileContent: UnwindSafe + RefUnwindSafe, Path: RefUnwindSafe,
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<X> Pipe for X
impl<X> Pipe for X
source§fn pipe<Return, Function>(self, f: Function) -> Returnwhere
Self: Sized,
Function: FnOnce(Self) -> Return,
fn pipe<Return, Function>(self, f: Function) -> Returnwhere Self: Sized, Function: FnOnce(Self) -> Return,
source§fn pipe_ref<'a, Return, Function>(&'a self, f: Function) -> Returnwhere
Function: FnOnce(&'a Self) -> Return,
fn pipe_ref<'a, Return, Function>(&'a self, f: Function) -> Returnwhere Function: FnOnce(&'a Self) -> Return,
source§fn pipe_mut<'a, Return, Function>(&'a mut self, f: Function) -> Returnwhere
Function: FnOnce(&'a mut Self) -> Return,
fn pipe_mut<'a, Return, Function>(&'a mut self, f: Function) -> Returnwhere Function: FnOnce(&'a mut Self) -> Return,
source§fn pipe_as_ref<'a, Param, Return, Function>(&'a self, f: Function) -> Returnwhere
Self: AsRef<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
fn pipe_as_ref<'a, Param, Return, Function>(&'a self, f: Function) -> Returnwhere Self: AsRef<Param>, Param: 'a + ?Sized, Function: FnOnce(&'a Param) -> Return,
f
to &self
where f
takes a single parameter of type Param
and Self
implements trait AsRef<Param>
. Read moresource§fn pipe_as_mut<'a, Param, Return, Function>(&'a mut self, f: Function) -> Returnwhere
Self: AsMut<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
fn pipe_as_mut<'a, Param, Return, Function>(&'a mut self, f: Function) -> Returnwhere Self: AsMut<Param>, Param: 'a + ?Sized, Function: FnOnce(&'a mut Param) -> Return,
f
to &mut self
where f
takes a single parameter of type Param
and Self
implements trait AsMut<Param>
. Read moresource§fn pipe_deref<'a, Param, Return, Function>(&'a self, f: Function) -> Returnwhere
Self: Deref<Target = Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
fn pipe_deref<'a, Param, Return, Function>(&'a self, f: Function) -> Returnwhere Self: Deref<Target = Param>, Param: 'a + ?Sized, Function: FnOnce(&'a Param) -> Return,
f
to &self
where f
takes a single parameter of type Param
and Self
implements trait Deref<Target = Param>
. Read moresource§fn pipe_deref_mut<'a, Param, Return, Function>(
&'a mut self,
f: Function
) -> Returnwhere
Self: DerefMut<Target = Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
fn pipe_deref_mut<'a, Param, Return, Function>( &'a mut self, f: Function ) -> Returnwhere Self: DerefMut<Target = Param>, Param: 'a + ?Sized, Function: FnOnce(&'a mut Param) -> Return,
f
to &mut self
where f
takes a single parameter of type Param
and Self
implements trait [DerefMut<Target = Param>
]. Read moresource§fn pipe_borrow<'a, Param, Return, Function>(&'a self, f: Function) -> Returnwhere
Self: Borrow<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
fn pipe_borrow<'a, Param, Return, Function>(&'a self, f: Function) -> Returnwhere Self: Borrow<Param>, Param: 'a + ?Sized, Function: FnOnce(&'a Param) -> Return,
f
to &self
where f
takes a single parameter of type Param
and Self
implements trait Borrow<Param>
. Read moresource§fn pipe_borrow_mut<'a, Param, Return, Function>(
&'a mut self,
f: Function
) -> Returnwhere
Self: BorrowMut<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
fn pipe_borrow_mut<'a, Param, Return, Function>( &'a mut self, f: Function ) -> Returnwhere Self: BorrowMut<Param>, Param: 'a + ?Sized, Function: FnOnce(&'a mut Param) -> Return,
f
to &mut self
where f
takes a single parameter of type Param
and Self
implements trait BorrowMut<Param>
. Read more