pub struct Paths {
pub root_path: PathBuf,
pub examples_path: PathBuf,
pub cargo_toml_path: PathBuf,
pub manifest: Manifest,
}Expand description
Represents path info on a Cargo project.
Fields§
§root_path: PathBufBase path to a Cargo project directory
examples_path: PathBufPath to the examples in a Cargo project
cargo_toml_path: PathBufPath to the Cargo.toml file
manifest: ManifestParsed contents of the Cargo.toml manifest file
Implementations§
source§impl Paths
impl Paths
sourcepub fn resolve() -> Result<Self>
pub fn resolve() -> Result<Self>
Iterates backward from the current directory, and locates the base
Cargo directory for the project – which contains at the minimum a
Cargo.toml file and an examples folder.
Returns
Returns the path details on the first such directory path which matches the criteria.
Errors
Raises an error if it cannot locate the base Cargo directory for the project.
sourcepub fn example_files(&self) -> Result<BTreeMap<Cow<'_, str>, ExampleFile>>
pub fn example_files(&self) -> Result<BTreeMap<Cow<'_, str>, ExampleFile>>
Returns an ordered (A -> Z) mapping of file name to resolved file
(ExampleFile objects) of each example file in the Cargo project.