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