Struct build_fs_tree::MergeableFileSystemTree[][src]

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>>

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]

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]

Get immutable reference to a descendant of any level.

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]

Get mutable reference to the directory content.

pub fn path_mut<'a>(
    &'a mut self,
    path: &'a mut impl Iterator<Item = &'a Path>
) -> Option<&'a mut Self>
[src]

Get mutable reference to a descendant of any level.

Trait Implementations

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]

Performs the conversion.

impl<Path, FileContent> AsRef<FileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent> where
    Path: Ord
[src]

fn as_ref(&self) -> &FileSystemTree<Path, FileContent>[src]

Performs the conversion.

impl<Name, FileContent> Build<Name, Error> for MergeableFileSystemTree<Name, FileContent> where
    Name: AsRef<Path> + Ord,
    FileContent: AsRef<[u8]>, 
[src]

type Path = PathBuf

Locations of the items in the filesystem.

fn join(prefix: &Self::Path, name: &Name) -> Self::Path[src]

Add prefix to the root of the tree.

fn write_file(
    path: &Self::Path,
    content: &Self::FileContent
) -> Result<(), Error>
[src]

Write content to a file.

fn create_dir(path: &Self::Path) -> Result<(), Error>[src]

Create a directory at root.

fn build(self, path: &Self::Path) -> Result<(), BuildError<Self::Path, Error>>[src]

Build the tree into the filesystem.

impl<Path: Clone, FileContent: Clone> Clone for MergeableFileSystemTree<Path, FileContent> where
    Path: Ord
[src]

fn clone(&self) -> MergeableFileSystemTree<Path, FileContent>[src]

Returns a copy of the value. Read more

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 MergeableFileSystemTree<Path, FileContent> where
    Path: Ord
[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<Path, FileContent> Deref for MergeableFileSystemTree<Path, FileContent> where
    Path: Ord
[src]

type Target = FileSystemTree<Path, FileContent>

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

Dereferences the value.

impl<Path, FileContent> DerefMut for MergeableFileSystemTree<Path, FileContent> where
    Path: Ord
[src]

fn deref_mut(&mut self) -> &mut Self::Target[src]

Mutably dereferences the value.

impl<'de, Path, FileContent> Deserialize<'de> for MergeableFileSystemTree<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]

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]

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]

fn from(original: MergeableFileSystemTree<Path, FileContent>) -> Self[src]

Performs the conversion.

impl<Path, FileContent> Node for MergeableFileSystemTree<Path, FileContent> where
    Path: Ord
[src]

type FileContent = FileContent

Content of the node if it is a file.

type DirectoryContent = BTreeMap<Path, Self>

Content of the node if it is a directory.

fn read(self) -> NodeContent<FileContent, Self::DirectoryContent>[src]

Read the content of the node.

impl<Path: PartialEq, FileContent: PartialEq> PartialEq<MergeableFileSystemTree<Path, FileContent>> for MergeableFileSystemTree<Path, FileContent> where
    Path: Ord
[src]

fn eq(&self, other: &MergeableFileSystemTree<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: &MergeableFileSystemTree<Path, FileContent>) -> bool[src]

This method tests for !=.

impl<Path, FileContent> Serialize for MergeableFileSystemTree<Path, FileContent> where
    Path: Ord,
    Path: Serialize,
    FileContent: Serialize
[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl<Path: Eq, FileContent: Eq> Eq for MergeableFileSystemTree<Path, FileContent> where
    Path: Ord
[src]

impl<Path, FileContent> StructuralEq for MergeableFileSystemTree<Path, FileContent> where
    Path: Ord
[src]

impl<Path, FileContent> StructuralPartialEq for MergeableFileSystemTree<Path, FileContent> where
    Path: Ord
[src]

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: RefUnwindSafe + UnwindSafe,
    Path: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<X> Pipe for X[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]

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]

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]

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]

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]

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]

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]

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]

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]

type Owned = T

The resulting type after obtaining ownership.

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]

🔬 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, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]