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>
impl<Name, FileContent> Build<Name, Error> for FileSystemTree<Name, FileContent>
Source§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>
impl<Path, FileContent: Clone> Clone for FileSystemTree<Path, FileContent>
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>
impl<Path, FileContent: Debug> Debug for FileSystemTree<Path, FileContent>
Source§impl<'de, Path, FileContent> Deserialize<'de> for FileSystemTree<Path, FileContent>
impl<'de, Path, FileContent> Deserialize<'de> for FileSystemTree<Path, FileContent>
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(value: FileSystemTree<Path, FileContent>) -> Self
fn from(value: FileSystemTree<Path, FileContent>) -> Self
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(value: MergeableFileSystemTree<Path, FileContent>) -> Self
fn from(value: 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,
Source§type FileContent = FileContent
type FileContent = FileContent
Source§type DirectoryContent = BTreeMap<Path, FileSystemTree<Path, FileContent>>
type DirectoryContent = BTreeMap<Path, FileSystemTree<Path, FileContent>>
Source§fn read(self) -> NodeContent<FileContent, Self::DirectoryContent>
fn read(self) -> NodeContent<FileContent, Self::DirectoryContent>
Source§impl<Path, FileContent: PartialEq> PartialEq for FileSystemTree<Path, FileContent>
impl<Path, FileContent: PartialEq> PartialEq for FileSystemTree<Path, FileContent>
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>
impl<Path, FileContent> Serialize for FileSystemTree<Path, FileContent>
impl<Path, FileContent: Eq> Eq for FileSystemTree<Path, FileContent>
impl<Path, FileContent> StructuralPartialEq for FileSystemTree<Path, FileContent>where
Path: Ord,
Auto Trait Implementations§
impl<Path, FileContent> Freeze for FileSystemTree<Path, FileContent>where
FileContent: Freeze,
impl<Path, FileContent> RefUnwindSafe for FileSystemTree<Path, FileContent>where
FileContent: RefUnwindSafe,
Path: RefUnwindSafe,
impl<Path, FileContent> Send for FileSystemTree<Path, FileContent>
impl<Path, FileContent> Sync for FileSystemTree<Path, FileContent>
impl<Path, FileContent> Unpin for FileSystemTree<Path, FileContent>where
FileContent: Unpin,
impl<Path, FileContent> UnwindSafe for FileSystemTree<Path, FileContent>
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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_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) -> Return
fn pipe_as_ref<'a, Param, Return, Function>(&'a self, f: Function) -> 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) -> Return
fn pipe_as_mut<'a, Param, Return, Function>(&'a mut self, f: Function) -> 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) -> Return
fn pipe_deref<'a, Param, Return, Function>(&'a self, f: Function) -> 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) -> Return
fn pipe_borrow<'a, Param, Return, Function>(&'a self, f: Function) -> 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,
) -> Return
fn pipe_borrow_mut<'a, Param, Return, Function>( &'a mut self, f: Function, ) -> Return
f
to &mut self
where f
takes a single parameter of type Param
and Self
implements trait BorrowMut<Param>
. Read more