pub struct Project {
pub path: PathBuf,
/* private fields */
}
Expand description
Project represents a project created on the file system at any user-defined location defined by
the path parameter to the new()
function.
This struct as a builder so directories and files can be added to it. Remember to call build()
at the end to create the project in the filesystem. The dirs vector will contain all the dirs &
subdirs in the project, which are added when the directory is added to the project.
Fields§
§path: PathBuf
Implementations§
source§impl Project
impl Project
sourcepub fn new<T>(path: T) -> Projectwhere
T: Into<PathBuf> + Clone,
pub fn new<T>(path: T) -> Projectwhere
T: Into<PathBuf> + Clone,
Creates a new Project at the specified path
. This will automatically add a “root” directory
to the dirs
vector.
sourcepub fn build(self) -> Self
pub fn build(self) -> Self
Creates the project in the filesystem. This will create all the directories & files that are
added by using add_dir()
.
No function should be chained for this, except for clear()
.
Function panics if the directory or file cannot be created or written to.
sourcepub fn add_dir(self, directory: Dir) -> Self
pub fn add_dir(self, directory: Dir) -> Self
Adds a directory to the chain which will be created when build()
is called. This accepts
a Dir, with the files already attached to it.
To add a subdirectory, specify the path from the project root.
To add files to the root of a directory, you need to call add_dir()
and give a path which
matches the project path.