Enum build_fs_tree::FileSystemTree[][src]

pub enum FileSystemTree<Path, FileContent> where
    Path: Ord
{ File(FileContent), Directory(BTreeMap<Path, Self>), }

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

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

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]

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

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

type Path = PathBuf

Locations of the items in the filesystem.

impl<Path: Clone, FileContent: Clone> Clone 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<Path: Eq, FileContent: Eq> Eq for FileSystemTree<Path, FileContent> where
    Path: Ord
[src]

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

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

impl<Path, FileContent> Node for FileSystemTree<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.

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

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

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

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

Auto Trait Implementations

impl<Path, FileContent> RefUnwindSafe for FileSystemTree<Path, FileContent> where
    FileContent: RefUnwindSafe,
    Path: RefUnwindSafe

impl<Path, FileContent> Send for FileSystemTree<Path, FileContent> where
    FileContent: Send,
    Path: Send

impl<Path, FileContent> Sync for FileSystemTree<Path, FileContent> where
    FileContent: Sync,
    Path: Sync

impl<Path, FileContent> Unpin for FileSystemTree<Path, FileContent> where
    FileContent: Unpin

impl<Path, FileContent> UnwindSafe for FileSystemTree<Path, FileContent> where
    FileContent: RefUnwindSafe + UnwindSafe,
    Path: RefUnwindSafe

Blanket Implementations

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

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

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

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

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

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

impl<X> Pipe for X[src]

impl<X> Pipe for X[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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.