Enum build_fs_tree::FileSystemTree [−][src]
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
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
impl<Path, FileContent> FileSystemTree<Path, FileContent> where
Path: Ord,
[src]
impl<Path, FileContent> FileSystemTree<Path, FileContent> where
Path: Ord,
[src]pub fn file_content(&self) -> Option<&FileContent>
[src]
pub fn file_content(&self) -> Option<&FileContent>
[src]Get immutable reference to the file content.
pub fn dir_content(&self) -> Option<&BTreeMap<Path, Self>>
[src]
pub fn dir_content(&self) -> Option<&BTreeMap<Path, Self>>
[src]Get immutable reference to the directory content.
pub fn path<'a>(
&'a self,
path: &'a mut impl Iterator<Item = &'a Path>
) -> Option<&'a Self>
[src]
pub fn path<'a>(
&'a self,
path: &'a mut impl Iterator<Item = &'a Path>
) -> Option<&'a Self>
[src]Get immutable reference to a descendant of any level.
pub fn file_content_mut(&mut self) -> Option<&mut FileContent>
[src]
pub fn file_content_mut(&mut self) -> Option<&mut FileContent>
[src]Get mutable reference to the file content.
pub fn dir_content_mut(&mut self) -> Option<&mut BTreeMap<Path, Self>>
[src]
pub fn dir_content_mut(&mut self) -> Option<&mut BTreeMap<Path, Self>>
[src]Get mutable reference to the directory content.
Trait Implementations
impl<Path, FileContent> AsMut<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
[src]
impl<Path, FileContent> AsMut<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
[src]fn as_mut(&mut self) -> &mut FileSystemTree<Path, FileContent>
[src]
fn as_mut(&mut self) -> &mut FileSystemTree<Path, FileContent>
[src]Performs the conversion.
impl<Path, FileContent> AsRef<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
[src]
impl<Path, FileContent> AsRef<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
[src]fn as_ref(&self) -> &FileSystemTree<Path, FileContent>
[src]
fn as_ref(&self) -> &FileSystemTree<Path, FileContent>
[src]Performs the conversion.
impl<Name, FileContent> Build<Name, Error> for FileSystemTree<Name, FileContent> where
Name: AsRef<Path> + Ord,
FileContent: AsRef<[u8]>,
[src]
impl<Name, FileContent> Build<Name, Error> for FileSystemTree<Name, FileContent> where
Name: AsRef<Path> + Ord,
FileContent: AsRef<[u8]>,
[src]fn write_file(
path: &Self::Path,
content: &Self::FileContent
) -> Result<(), Error>
[src]
fn write_file(
path: &Self::Path,
content: &Self::FileContent
) -> Result<(), Error>
[src]Write content to a file.
impl<Path: Clone, FileContent: Clone> Clone for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]
impl<Path: Clone, FileContent: Clone> Clone for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]fn clone(&self) -> FileSystemTree<Path, FileContent>
[src]
fn clone(&self) -> FileSystemTree<Path, FileContent>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<Path: Debug, FileContent: Debug> Debug for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]
impl<Path: Debug, FileContent: Debug> Debug for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]impl<'de, Path, FileContent> Deserialize<'de> for FileSystemTree<Path, FileContent> where
Path: Ord,
Path: Deserialize<'de>,
FileContent: Deserialize<'de>,
[src]
impl<'de, Path, FileContent> Deserialize<'de> for FileSystemTree<Path, FileContent> where
Path: Ord,
Path: Deserialize<'de>,
FileContent: Deserialize<'de>,
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl<Path, FileContent> From<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
[src]
impl<Path, FileContent> From<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
[src]fn from(
original: FileSystemTree<Path, FileContent>
) -> MergeableFileSystemTree<Path, FileContent>
[src]
fn from(
original: FileSystemTree<Path, FileContent>
) -> MergeableFileSystemTree<Path, FileContent>
[src]Performs the conversion.
impl<Path, FileContent> From<MergeableFileSystemTree<Path, FileContent>> for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]
impl<Path, FileContent> From<MergeableFileSystemTree<Path, FileContent>> for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]fn from(original: MergeableFileSystemTree<Path, FileContent>) -> Self
[src]
fn from(original: MergeableFileSystemTree<Path, FileContent>) -> Self
[src]Performs the conversion.
impl<Path, FileContent> Node for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]
impl<Path, FileContent> Node for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]type FileContent = FileContent
type FileContent = FileContent
Content of the node if it is a file.
type DirectoryContent = BTreeMap<Path, Self>
type DirectoryContent = BTreeMap<Path, Self>
Content of the node if it is a directory.
fn read(self) -> NodeContent<FileContent, Self::DirectoryContent>
[src]
fn read(self) -> NodeContent<FileContent, Self::DirectoryContent>
[src]Read the content of the node.
impl<Path: PartialEq, FileContent: PartialEq> PartialEq<FileSystemTree<Path, FileContent>> for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]
impl<Path: PartialEq, FileContent: PartialEq> PartialEq<FileSystemTree<Path, FileContent>> for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]fn eq(&self, other: &FileSystemTree<Path, FileContent>) -> bool
[src]
fn eq(&self, other: &FileSystemTree<Path, FileContent>) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &FileSystemTree<Path, FileContent>) -> bool
[src]
fn ne(&self, other: &FileSystemTree<Path, FileContent>) -> bool
[src]This method tests for !=
.
impl<Path, FileContent> Serialize for FileSystemTree<Path, FileContent> where
Path: Ord,
Path: Serialize,
FileContent: Serialize,
[src]
impl<Path, FileContent> Serialize for FileSystemTree<Path, FileContent> where
Path: Ord,
Path: Serialize,
FileContent: Serialize,
[src]impl<Path: Eq, FileContent: Eq> Eq for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]
Path: Ord,
impl<Path, FileContent> StructuralEq for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]
Path: Ord,
impl<Path, FileContent> StructuralPartialEq for FileSystemTree<Path, FileContent> where
Path: Ord,
[src]
Path: Ord,
Auto Trait Implementations
impl<Path, FileContent> RefUnwindSafe for FileSystemTree<Path, FileContent> where
FileContent: RefUnwindSafe,
Path: RefUnwindSafe,
FileContent: RefUnwindSafe,
Path: RefUnwindSafe,
impl<Path, FileContent> Send for FileSystemTree<Path, FileContent> where
FileContent: Send,
Path: Send,
FileContent: Send,
Path: Send,
impl<Path, FileContent> Sync for FileSystemTree<Path, FileContent> where
FileContent: Sync,
Path: Sync,
FileContent: Sync,
Path: Sync,
impl<Path, FileContent> Unpin for FileSystemTree<Path, FileContent> where
FileContent: Unpin,
FileContent: Unpin,
impl<Path, FileContent> UnwindSafe for FileSystemTree<Path, FileContent> where
FileContent: RefUnwindSafe + UnwindSafe,
Path: RefUnwindSafe,
FileContent: RefUnwindSafe + UnwindSafe,
Path: RefUnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<X> Pipe for X
[src]
impl<X> Pipe for X
[src]fn pipe<Return, Function>(self, f: Function) -> Return where
Function: FnOnce(Self) -> Return,
[src]
fn pipe<Return, Function>(self, f: Function) -> Return where
Function: FnOnce(Self) -> Return,
[src]Apply f
to self
. Read more
fn pipe_ref<'a, Return, Function>(&'a self, f: Function) -> Return where
Function: FnOnce(&'a Self) -> Return,
[src]
fn pipe_ref<'a, Return, Function>(&'a self, f: Function) -> Return where
Function: FnOnce(&'a Self) -> Return,
[src]Apply f
to &self
. Read more
fn pipe_mut<'a, Return, Function>(&'a mut self, f: Function) -> Return where
Function: FnOnce(&'a mut Self) -> Return,
[src]
fn pipe_mut<'a, Return, Function>(&'a mut self, f: Function) -> Return where
Function: FnOnce(&'a mut Self) -> Return,
[src]Apply f
to &mut self
. Read more
fn pipe_as_ref<'a, Param, Return, Function>(&'a self, f: Function) -> Return where
Self: AsRef<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
[src]
fn pipe_as_ref<'a, Param, Return, Function>(&'a self, f: Function) -> Return where
Self: AsRef<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
[src]Apply f
to &self
where f
takes a single parameter of type Param
and Self
implements trait AsRef<Param>
. Read more
fn pipe_as_mut<'a, Param, Return, Function>(&'a mut self, f: Function) -> Return where
Self: AsMut<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
[src]
fn pipe_as_mut<'a, Param, Return, Function>(&'a mut self, f: Function) -> Return where
Self: AsMut<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
[src]Apply f
to &mut self
where f
takes a single parameter of type Param
and Self
implements trait AsMut<Param>
. Read more
fn pipe_deref<'a, Param, Return, Function>(&'a self, f: Function) -> Return where
Self: Deref<Target = Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
[src]
fn pipe_deref<'a, Param, Return, Function>(&'a self, f: Function) -> Return where
Self: Deref<Target = Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
[src]Apply f
to &self
where f
takes a single parameter of type Param
and Self
implements trait Deref<Param>
. Read more
fn pipe_deref_mut<'a, Param, Return, Function>(
&'a mut self,
f: Function
) -> Return where
Self: DerefMut<Target = Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
[src]
fn pipe_deref_mut<'a, Param, Return, Function>(
&'a mut self,
f: Function
) -> Return where
Self: DerefMut<Target = Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
[src]Apply f
to &mut self
where f
takes a single parameter of type Param
and Self
implements trait DerefMut<Param>
. Read more
fn pipe_borrow<'a, Param, Return, Function>(&'a self, f: Function) -> Return where
Self: Borrow<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
[src]
fn pipe_borrow<'a, Param, Return, Function>(&'a self, f: Function) -> Return where
Self: Borrow<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
[src]Apply f
to &self
where f
takes a single parameter of type Param
and Self
implements trait Deref<Param>
. Read more
fn pipe_borrow_mut<'a, Param, Return, Function>(
&'a mut self,
f: Function
) -> Return where
Self: BorrowMut<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
[src]
fn pipe_borrow_mut<'a, Param, Return, Function>(
&'a mut self,
f: Function
) -> Return where
Self: BorrowMut<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
[src]Apply f
to &mut self
where f
takes a single parameter of type Param
and Self
implements trait DerefMut<Param>
. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,