pub struct RepositoryPath(PathBuf);Expand description
A normalized, relative, parent-free repository path.
TryFrom is the only way to build one, so every value already holds
the invariant: no absolute paths, no empty segments, and no ..
traversal. "." is accepted as a reference to the repository root.
Tuple Fields§
§0: PathBufImplementations§
Source§impl RepositoryPath
impl RepositoryPath
Sourcepub fn resolve(&self, root: &RepositoryRoot) -> Result<PathBuf, PathError>
pub fn resolve(&self, root: &RepositoryRoot) -> Result<PathBuf, PathError>
Resolve this path against a repository root, rejecting symlinks in any parent or leaf component.
Missing final files are allowed so callers can safely plan their creation.
§Errors
Returns an error when a parent or leaf component is a symlink, an ancestor is inaccessible, or the resolved path escapes the repository.
Sourcepub(crate) fn reject_case_collisions<'a>(
paths: impl IntoIterator<Item = &'a Self>,
) -> Result<(), FilesError>
pub(crate) fn reject_case_collisions<'a>( paths: impl IntoIterator<Item = &'a Self>, ) -> Result<(), FilesError>
Reject a set of paths that differ only by case.
Two declared paths differing only in case collide on the
case-insensitive filesystems macOS and Windows default to, even
though RepositoryPath equality is byte-exact.
§Errors
Returns an error naming the first two paths found that are distinct but match when lowercased.
Trait Implementations§
Source§impl Clone for RepositoryPath
impl Clone for RepositoryPath
Source§fn clone(&self) -> RepositoryPath
fn clone(&self) -> RepositoryPath
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 RepositoryPath
impl Debug for RepositoryPath
Source§impl Display for RepositoryPath
impl Display for RepositoryPath
impl Eq for RepositoryPath
Source§impl<'ʄ> Facet<'ʄ> for RepositoryPath
impl<'ʄ> Facet<'ʄ> for RepositoryPath
Source§impl From<&RepositoryPath> for String
impl From<&RepositoryPath> for String
Source§fn from(path: &RepositoryPath) -> Self
fn from(path: &RepositoryPath) -> Self
Source§impl FromStr for RepositoryPath
impl FromStr for RepositoryPath
Source§impl Hash for RepositoryPath
impl Hash for RepositoryPath
Source§impl Ord for RepositoryPath
impl Ord for RepositoryPath
Source§fn cmp(&self, other: &RepositoryPath) -> Ordering
fn cmp(&self, other: &RepositoryPath) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for RepositoryPath
impl PartialEq for RepositoryPath
Source§impl PartialOrd for RepositoryPath
impl PartialOrd for RepositoryPath
impl StructuralPartialEq for RepositoryPath
Source§impl TryFrom<&Path> for RepositoryPath
impl TryFrom<&Path> for RepositoryPath
Source§impl TryFrom<&str> for RepositoryPath
impl TryFrom<&str> for RepositoryPath
Auto Trait Implementations§
impl Freeze for RepositoryPath
impl RefUnwindSafe for RepositoryPath
impl Send for RepositoryPath
impl Sync for RepositoryPath
impl Unpin for RepositoryPath
impl UnsafeUnpin for RepositoryPath
impl UnwindSafe for RepositoryPath
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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.