pub struct CanonicalProjectRoot(/* private fields */);Expand description
One canonical native filesystem root.
Equality is native-path equality after filesystem canonicalization. The value is the authority for routing and persistence; its display projection is only for terminal diagnostics and compatibility metadata.
Implementations§
Source§impl CanonicalProjectRoot
impl CanonicalProjectRoot
Sourcepub fn from_path(path: &Path) -> CoreResult<Self>
pub fn from_path(path: &Path) -> CoreResult<Self>
Canonicalize an existing absolute directory into a native identity.
§Errors
Returns an error when the path is relative, missing, or cannot be canonicalized by the host filesystem.
Sourcepub fn from_persisted_path(path: PathBuf) -> CoreResult<Self>
pub fn from_persisted_path(path: PathBuf) -> CoreResult<Self>
Construct an identity from a persisted native path whose filesystem object may no longer exist.
This is the migration and recovery entry point for historical
worktree identities. It uses the same identity type and lexical
validation as Self::decode, but deliberately does not require a
live directory. Active filesystem admission must continue to use
Self::from_path.
§Errors
Returns an error when the path is relative, contains an interior NUL, or does not satisfy the native canonical lexical contract.
Sourcepub fn display_string(&self) -> CoreResult<String>
pub fn display_string(&self) -> CoreResult<String>
Return the UTF-8 terminal/compatibility display projection.
A native root containing bytes that are not UTF-8 has no lossless text display. Callers carrying identity or compatibility state must retain this typed refusal instead of turning the path into replacement text.
§Errors
Returns CoreError::NonUtf8Path when the native path has no lossless
UTF-8 display projection.
Sourcepub fn display_string_lossy(&self) -> String
pub fn display_string_lossy(&self) -> String
Return an explicitly lossy rendering for terminal-only diagnostics.
This method must not be used for identity comparison, persistence, compatibility keys, or structured adapter results.
Sourcepub fn encode(&self) -> CoreResult<Vec<u8>>
pub fn encode(&self) -> CoreResult<Vec<u8>>
Encode the native path without lossy text conversion.
§Errors
Returns an error when the host cannot encode its native path format.
Sourcepub fn decode(encoded: &[u8]) -> CoreResult<Self>
pub fn decode(encoded: &[u8]) -> CoreResult<Self>
Decode one versioned native path codec value.
§Errors
Returns an error when the version, platform, bytes, or decoded path is invalid.
Trait Implementations§
Source§impl Clone for CanonicalProjectRoot
impl Clone for CanonicalProjectRoot
Source§fn clone(&self) -> CanonicalProjectRoot
fn clone(&self) -> CanonicalProjectRoot
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 CanonicalProjectRoot
impl Debug for CanonicalProjectRoot
Source§impl Display for CanonicalProjectRoot
impl Display for CanonicalProjectRoot
impl Eq for CanonicalProjectRoot
Source§impl Hash for CanonicalProjectRoot
impl Hash for CanonicalProjectRoot
Source§impl PartialEq for CanonicalProjectRoot
impl PartialEq for CanonicalProjectRoot
Source§fn eq(&self, other: &CanonicalProjectRoot) -> bool
fn eq(&self, other: &CanonicalProjectRoot) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CanonicalProjectRoot
Auto Trait Implementations§
impl Freeze for CanonicalProjectRoot
impl RefUnwindSafe for CanonicalProjectRoot
impl Send for CanonicalProjectRoot
impl Sync for CanonicalProjectRoot
impl Unpin for CanonicalProjectRoot
impl UnsafeUnpin for CanonicalProjectRoot
impl UnwindSafe for CanonicalProjectRoot
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.