pub struct ProjectRootId(/* private fields */);Expand description
Stable canonical identity for a project root.
A ProjectRootId is represented by the canonical filesystem path of an
existing project root. Construction uses std::fs::canonicalize, so the
stored path is absolute, has ./../trailing separators collapsed, and has
symlinks resolved.
Git worktrees are first-class roots: this crate does not ask Git for a repository common-dir and does not collapse linked worktrees back to their main checkout. Because a linked worktree has its own checkout directory, the canonical worktree path is a distinct id from the canonical main-checkout path while alternate spellings of either path still converge.
Implementations§
Source§impl ProjectRootId
impl ProjectRootId
Sourcepub fn from_path(path: impl AsRef<Path>) -> Result<Self, IdentityError>
pub fn from_path(path: impl AsRef<Path>) -> Result<Self, IdentityError>
Resolve an existing filesystem path into a canonical project-root id.
Non-existent paths are rejected with IdentityError::NonExistentPath
instead of being logically normalized. That policy avoids silently
aliasing roots whose future meaning could change when missing path
components or symlinks are later created.
Sourcepub fn into_path_buf(self) -> PathBuf
pub fn into_path_buf(self) -> PathBuf
Consume the identity and return its canonical path representation.
Trait Implementations§
Source§impl AsRef<Path> for ProjectRootId
impl AsRef<Path> for ProjectRootId
Source§impl Clone for ProjectRootId
impl Clone for ProjectRootId
Source§fn clone(&self) -> ProjectRootId
fn clone(&self) -> ProjectRootId
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProjectRootId
impl Debug for ProjectRootId
Source§impl Display for ProjectRootId
impl Display for ProjectRootId
impl Eq for ProjectRootId
Source§impl From<ProjectRootId> for PathBuf
impl From<ProjectRootId> for PathBuf
Source§fn from(value: ProjectRootId) -> Self
fn from(value: ProjectRootId) -> Self
Source§impl Hash for ProjectRootId
impl Hash for ProjectRootId
Source§impl PartialEq for ProjectRootId
impl PartialEq for ProjectRootId
Source§fn eq(&self, other: &ProjectRootId) -> bool
fn eq(&self, other: &ProjectRootId) -> bool
self and other values to be equal, and is used by ==.