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§
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>
Converts this type into a mutable reference of the (usually inferred) input type.
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>
Converts this type into a shared reference of the (usually inferred) input type.
source§impl<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]>,
§type BorrowedPath = Path
type BorrowedPath = Path
Build target.
source§fn join(prefix: &Self::BorrowedPath, name: &Name) -> Self::OwnedPath
fn join(prefix: &Self::BorrowedPath, name: &Name) -> Self::OwnedPath
Add prefix to the root of the tree.
source§fn write_file(
path: &Self::BorrowedPath,
content: &Self::FileContent
) -> Result<(), Error>
fn write_file( path: &Self::BorrowedPath, content: &Self::FileContent ) -> Result<(), Error>
Write content to a file.
source§fn create_dir(path: &Self::BorrowedPath) -> Result<(), Error>
fn create_dir(path: &Self::BorrowedPath) -> Result<(), Error>
Create a directory at root.
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>,
Build the tree into the filesystem.
source§impl<Path, FileContent: Clone> Clone for MergeableFileSystemTree<Path, FileContent>where
Path: Ord + Clone,
impl<Path, FileContent: Clone> Clone for MergeableFileSystemTree<Path, FileContent>where Path: Ord + Clone,
source§fn clone(&self) -> MergeableFileSystemTree<Path, FileContent>
fn clone(&self) -> MergeableFileSystemTree<Path, FileContent>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<Path, FileContent: Debug> Debug for MergeableFileSystemTree<Path, FileContent>where
Path: Ord + Debug,
impl<Path, FileContent: Debug> Debug for MergeableFileSystemTree<Path, FileContent>where Path: Ord + Debug,
source§impl<Path, FileContent> Deref for MergeableFileSystemTree<Path, FileContent>where
Path: Ord,
impl<Path, FileContent> Deref for MergeableFileSystemTree<Path, FileContent>where Path: Ord,
source§impl<Path, FileContent> DerefMut for MergeableFileSystemTree<Path, FileContent>where
Path: Ord,
impl<Path, FileContent> DerefMut for MergeableFileSystemTree<Path, FileContent>where Path: Ord,
source§impl<'de, Path, FileContent> Deserialize<'de> for MergeableFileSystemTree<Path, FileContent>where
Path: Ord + Deserialize<'de>,
FileContent: Deserialize<'de>,
impl<'de, Path, FileContent> Deserialize<'de> for MergeableFileSystemTree<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>,
Deserialize this value from the given Serde deserializer. Read more
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>
Converts to this type from the input type.
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
Converts to this type from the input type.
source§impl<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.
source§fn read(self) -> NodeContent<FileContent, Self::DirectoryContent>
fn read(self) -> NodeContent<FileContent, Self::DirectoryContent>
Read the content of the node.
source§impl<Path, FileContent: PartialEq> PartialEq<MergeableFileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent>where
Path: Ord + PartialEq,
impl<Path, FileContent: PartialEq> PartialEq<MergeableFileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent>where Path: Ord + PartialEq,
source§fn 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 ==
.source§impl<Path, FileContent> Serialize for MergeableFileSystemTree<Path, FileContent>where
Path: Ord + Serialize,
FileContent: Serialize,
impl<Path, FileContent> Serialize for MergeableFileSystemTree<Path, FileContent>where Path: Ord + Serialize, FileContent: Serialize,
impl<Path, FileContent: Eq> Eq for MergeableFileSystemTree<Path, FileContent>where Path: Ord + Eq,
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§
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
Mutably borrows from an owned value. Read more
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
Compare self to
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,
Apply
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,
Apply
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,
Apply
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,
Apply
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,
Apply
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,
Apply
f
to &mut self
where f
takes a single parameter of type Param
and Self
implements trait BorrowMut<Param>
. Read more