Trait build_fs_tree::Build
source · pub trait Build<Name, Error>: Node + Sizedwhere
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§
sourcetype BorrowedPath: ToOwned<Owned = Self::OwnedPath> + ?Sized
type BorrowedPath: ToOwned<Owned = Self::OwnedPath> + ?Sized
Build target.
sourcetype OwnedPath: AsRef<Self::BorrowedPath>
type OwnedPath: AsRef<Self::BorrowedPath>
Locations of the items in the filesystem.
Required Methods§
sourcefn 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.
sourcefn 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.
sourcefn create_dir(path: &Self::BorrowedPath) -> Result<(), Error>
fn create_dir(path: &Self::BorrowedPath) -> Result<(), Error>
Create a directory at root.
Provided Methods§
sourcefn 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.
Object Safety§
This trait is not object safe.