Trait build_fs_tree::Build

source ·
pub trait Build<Name, Error>: Node + Sized
where Self::DirectoryContent: IntoIterator<Item = (Name, Self)>,
{ type BorrowedPath: ToOwned<Owned = Self::OwnedPath> + ?Sized; type OwnedPath: AsRef<Self::BorrowedPath>; // Required methods fn join(prefix: &Self::BorrowedPath, name: &Name) -> Self::OwnedPath; fn write_file( path: &Self::BorrowedPath, content: &Self::FileContent, ) -> Result<(), Error>; fn create_dir(path: &Self::BorrowedPath) -> Result<(), Error>; // Provided method fn build<Path>( self, path: Path, ) -> Result<(), BuildError<Self::OwnedPath, Error>> where Path: AsRef<Self::BorrowedPath> { ... } }
Expand description

Applying FileSystemTree to the filesystem.

Generic parameters:

  • Name: Identification of a child item.
  • Error: Error type used by the other functions.

Required Associated Types§

source

type BorrowedPath: ToOwned<Owned = Self::OwnedPath> + ?Sized

Build target.

source

type OwnedPath: AsRef<Self::BorrowedPath>

Locations of the items in the filesystem.

Required Methods§

source

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>

Write content to a file.

source

fn create_dir(path: &Self::BorrowedPath) -> Result<(), Error>

Create a directory at root.

Provided Methods§

source

fn build<Path>( self, path: Path, ) -> Result<(), BuildError<Self::OwnedPath, Error>>
where Path: AsRef<Self::BorrowedPath>,

Build the tree into the filesystem.

Object Safety§

This trait is not object safe.

Implementors§

source§

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

source§

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