use crate::{Build, MergeableFileSystemTree}; use std::{ fs::{create_dir_all, write}, io::Error, path::{Path, PathBuf}, }; impl Build for MergeableFileSystemTree where Name: AsRef + Ord, FileContent: AsRef<[u8]>, { type BorrowedPath = Path; type OwnedPath = PathBuf; fn join(prefix: &Self::BorrowedPath, name: &Name) -> Self::OwnedPath { prefix.join(name) } fn write_file(path: &Self::BorrowedPath, content: &Self::FileContent) -> Result<(), Error> { if let Some(dir) = path.parent() { create_dir_all(dir)?; } write(path, content) } fn create_dir(path: &Self::BorrowedPath) -> Result<(), Error> { create_dir_all(path) } }