Struct build_fs_tree::MergeableFileSystemTree
source · [−]pub struct MergeableFileSystemTree<Path, FileContent>(_)
where
Path: Ord;
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.
Generic parameters:
Path
: Reference to a file in the filesystem.FileContent
: Content of a file.
Difference from FileSystemTree
:
FileSystemTree::build
cannot write over an existing directory.
On the other hand, MergeableFileSystemTree::build
either merges
the two directories if there’s no conflict.
Methods from Deref<Target = FileSystemTree<Path, FileContent>>
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
sourceimpl<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,
sourcefn as_mut(&mut self) -> &mut FileSystemTree<Path, FileContent>
fn as_mut(&mut self) -> &mut FileSystemTree<Path, FileContent>
Converts this type into a mutable reference of the (usually inferred) input type.
sourceimpl<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,
sourcefn as_ref(&self) -> &FileSystemTree<Path, FileContent>
fn as_ref(&self) -> &FileSystemTree<Path, FileContent>
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl<Name, FileContent> Build<Name, Error> for MergeableFileSystemTree<Name, FileContent> where
Name: AsRef<Path> + Ord,
FileContent: AsRef<[u8]>,
impl<Name, FileContent> Build<Name, Error> for MergeableFileSystemTree<Name, FileContent> where
Name: AsRef<Path> + Ord,
FileContent: AsRef<[u8]>,
sourcefn write_file(
path: &Self::Path,
content: &Self::FileContent
) -> Result<(), Error>
fn write_file(
path: &Self::Path,
content: &Self::FileContent
) -> Result<(), Error>
Write content to a file.
sourceimpl<Path: Clone, FileContent: Clone> Clone for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
impl<Path: Clone, FileContent: Clone> Clone for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
sourcefn clone(&self) -> MergeableFileSystemTree<Path, FileContent>
fn clone(&self) -> MergeableFileSystemTree<Path, FileContent>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<Path: Debug, FileContent: Debug> Debug for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
impl<Path: Debug, FileContent: Debug> Debug for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
sourceimpl<Path, FileContent> Deref for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
impl<Path, FileContent> Deref for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
type Target = FileSystemTree<Path, FileContent>
type Target = FileSystemTree<Path, FileContent>
The resulting type after dereferencing.
sourceimpl<Path, FileContent> DerefMut for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
impl<Path, FileContent> DerefMut for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
sourceimpl<'de, Path, FileContent> Deserialize<'de> for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
Path: Deserialize<'de>,
FileContent: Deserialize<'de>,
impl<'de, Path, FileContent> Deserialize<'de> for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
Path: Deserialize<'de>,
FileContent: Deserialize<'de>,
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<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,
sourcefn from(
original: FileSystemTree<Path, FileContent>
) -> MergeableFileSystemTree<Path, FileContent>
fn from(
original: FileSystemTree<Path, FileContent>
) -> MergeableFileSystemTree<Path, FileContent>
Converts to this type from the input type.
sourceimpl<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,
sourcefn from(original: MergeableFileSystemTree<Path, FileContent>) -> Self
fn from(original: MergeableFileSystemTree<Path, FileContent>) -> Self
Converts to this type from the input type.
sourceimpl<Path, FileContent> Node for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
impl<Path, FileContent> Node for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
type FileContent = FileContent
type FileContent = FileContent
Content of the node if it is a file.
type DirectoryContent = BTreeMap<Path, MergeableFileSystemTree<Path, FileContent>, Global>
type DirectoryContent = BTreeMap<Path, MergeableFileSystemTree<Path, FileContent>, Global>
Content of the node if it is a directory.
sourcefn read(self) -> NodeContent<FileContent, Self::DirectoryContent>
fn read(self) -> NodeContent<FileContent, Self::DirectoryContent>
Read the content of the node.
sourceimpl<Path: PartialEq, FileContent: PartialEq> PartialEq<MergeableFileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
impl<Path: PartialEq, FileContent: PartialEq> PartialEq<MergeableFileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
sourcefn eq(&self, other: &MergeableFileSystemTree<Path, FileContent>) -> bool
fn eq(&self, other: &MergeableFileSystemTree<Path, FileContent>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &MergeableFileSystemTree<Path, FileContent>) -> bool
fn ne(&self, other: &MergeableFileSystemTree<Path, FileContent>) -> bool
This method tests for !=
.
sourceimpl<Path, FileContent> Serialize for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
Path: Serialize,
FileContent: Serialize,
impl<Path, FileContent> Serialize for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
Path: Serialize,
FileContent: Serialize,
impl<Path: Eq, FileContent: Eq> Eq for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
impl<Path, FileContent> StructuralEq for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
impl<Path, FileContent> StructuralPartialEq for MergeableFileSystemTree<Path, FileContent> where
Path: Ord,
Auto Trait Implementations
impl<Path, FileContent> RefUnwindSafe for MergeableFileSystemTree<Path, FileContent> where
FileContent: RefUnwindSafe,
Path: RefUnwindSafe,
impl<Path, FileContent> Send for MergeableFileSystemTree<Path, FileContent> where
FileContent: Send,
Path: Send,
impl<Path, FileContent> Sync for MergeableFileSystemTree<Path, FileContent> where
FileContent: Sync,
Path: Sync,
impl<Path, FileContent> Unpin for MergeableFileSystemTree<Path, FileContent> where
FileContent: Unpin,
impl<Path, FileContent> UnwindSafe for MergeableFileSystemTree<Path, FileContent> where
FileContent: UnwindSafe + RefUnwindSafe,
Path: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<X> Pipe for X
impl<X> Pipe for X
sourcefn pipe<Return, Function>(self, f: Function) -> Return where
Function: FnOnce(Self) -> Return,
fn pipe<Return, Function>(self, f: Function) -> Return where
Function: FnOnce(Self) -> Return,
Apply f
to self
. Read more
sourcefn pipe_ref<'a, Return, Function>(&'a self, f: Function) -> Return where
Function: FnOnce(&'a Self) -> Return,
fn pipe_ref<'a, Return, Function>(&'a self, f: Function) -> Return where
Function: FnOnce(&'a Self) -> Return,
Apply f
to &self
. Read more
sourcefn pipe_mut<'a, Return, Function>(&'a mut self, f: Function) -> Return where
Function: FnOnce(&'a mut Self) -> Return,
fn pipe_mut<'a, Return, Function>(&'a mut self, f: Function) -> Return where
Function: FnOnce(&'a mut Self) -> Return,
Apply f
to &mut self
. Read more
sourcefn pipe_as_ref<'a, Param, Return, Function>(&'a self, f: Function) -> Return where
Self: AsRef<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
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,
Apply f
to &self
where f
takes a single parameter of type Param
and Self
implements trait AsRef<Param>
. Read more
sourcefn 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,
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,
Apply f
to &mut self
where f
takes a single parameter of type Param
and Self
implements trait AsMut<Param>
. Read more
sourcefn pipe_deref<'a, Param, Return, Function>(&'a self, f: Function) -> Return where
Self: Deref<Target = Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
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,
Apply f
to &self
where f
takes a single parameter of type Param
and Self
implements trait Deref<Param>
. Read more
sourcefn 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,
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,
Apply f
to &mut self
where f
takes a single parameter of type Param
and Self
implements trait DerefMut<Param>
. Read more
sourcefn pipe_borrow<'a, Param, Return, Function>(&'a self, f: Function) -> Return where
Self: Borrow<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
fn pipe_borrow<'a, Param, Return, Function>(&'a self, f: Function) -> Return where
Self: Borrow<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
Apply f
to &self
where f
takes a single parameter of type Param
and Self
implements trait Deref<Param>
. Read more
sourcefn 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,
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,
Apply f
to &mut self
where f
takes a single parameter of type Param
and Self
implements trait DerefMut<Param>
. Read more