pub struct ProjectPaths { /* private fields */ }Expand description
A validated read-only dictionary of project-wide named filesystem paths.
Loading preserves declaration order and exact source bytes. It does not canonicalize paths, inspect targets, or require targets to exist.
Implementations§
Source§impl ProjectPaths
impl ProjectPaths
Sourcepub fn load(
project_root: impl Into<PathBuf>,
) -> Result<Self, ConfigurationError>
pub fn load( project_root: impl Into<PathBuf>, ) -> Result<Self, ConfigurationError>
Loads the standard config/paths.json beneath project_root.
Sourcepub fn project_root(&self) -> &Path
pub fn project_root(&self) -> &Path
Returns the project root supplied to Self::load.
Sourcepub fn source_path(&self) -> &Path
pub fn source_path(&self) -> &Path
Returns the exact paths.json source path.
Sourcepub fn source_json(&self) -> &[u8] ⓘ
pub fn source_json(&self) -> &[u8] ⓘ
Borrows the original validated source bytes without reserialization.
Sourcepub fn path(&self, key: &str) -> Option<&Path>
pub fn path(&self, key: &str) -> Option<&Path>
Borrows the declared path without resolving it against the project root.
Sourcepub fn require_path(&self, key: &str) -> Result<&Path, ConfigurationError>
pub fn require_path(&self, key: &str) -> Result<&Path, ConfigurationError>
Borrows a required declared path or returns an unknown-path error.
Sourcepub fn resolve_path(&self, key: &str) -> Result<PathBuf, ConfigurationError>
pub fn resolve_path(&self, key: &str) -> Result<PathBuf, ConfigurationError>
Returns an absolute declaration unchanged or joins a relative one to the project root.
Sourcepub fn keys(&self) -> impl ExactSizeIterator<Item = &str>
pub fn keys(&self) -> impl ExactSizeIterator<Item = &str>
Iterates names in source declaration order.
Sourcepub fn iter(&self) -> impl ExactSizeIterator<Item = (&str, &Path)>
pub fn iter(&self) -> impl ExactSizeIterator<Item = (&str, &Path)>
Iterates names and unresolved paths in source declaration order.
Sourcepub fn to_json_value(&self) -> Value
pub fn to_json_value(&self) -> Value
Returns a deterministic JSON object suitable for task provenance.
Trait Implementations§
Source§impl Clone for ProjectPaths
impl Clone for ProjectPaths
Source§fn clone(&self) -> ProjectPaths
fn clone(&self) -> ProjectPaths
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ProjectPaths
impl RefUnwindSafe for ProjectPaths
impl Send for ProjectPaths
impl Sync for ProjectPaths
impl Unpin for ProjectPaths
impl UnsafeUnpin for ProjectPaths
impl UnwindSafe for ProjectPaths
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more