pub fn traverse<E: Debug + Display + StdError>(
src: impl AsRef<Path>,
dest: impl AsRef<Path>,
transform_path: impl Fn(&Path) -> Result<PathBuf, E>,
template_ext: Option<&str>,
) -> Result<VecDeque<Action>, TraversalError<E>>
Expand description
Traverse file tree at src
to generate an Action
list.
The Action
list specifies how to generate the src
file tree at dest
,
and can be executed by Bicycle::process_actions
.
File tree contents are interpreted as follows:
- Each directory in the file tree generates an
Action::CreateDirectory
. Directories are traversed recursively. - Each file that doesn’t end in
template_ext
generates anAction::CopyFile
. - Each file that ends in
template_ext
generates anAction::WriteTemplate
.
transform_path
is used to post-process destination path strings.
Bicycle::transform_path
is one possible implementation.