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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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]>,