pub struct DestPath(/* private fields */);Expand description
Normalized relative path coordinate (always forward-slash).
Use resolve(root) to get a native filesystem path.
Implementations§
Source§impl DestPath
impl DestPath
Sourcepub fn new(value: impl AsRef<str>) -> Result<Self, DestPathError>
pub fn new(value: impl AsRef<str>) -> Result<Self, DestPathError>
Create from any string, normalizing separators and rejecting invalid paths.
Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Consume and return the inner string.
Sourcepub fn resolve(&self, root: &Path) -> PathBuf
pub fn resolve(&self, root: &Path) -> PathBuf
Resolve to a native filesystem path under the given root.
Sourcepub fn components(&self) -> impl Iterator<Item = &str>
pub fn components(&self) -> impl Iterator<Item = &str>
Split into path components (by forward slash).
Sourcepub fn item_name(&self, kind: ItemKind) -> String
pub fn item_name(&self, kind: ItemKind) -> String
Extract the installed item name from this path.
Agents strip a trailing .md; bootstrap docs use their containing directory
because their canonical path is bootstrap/<name>/BOOTSTRAP.md; all other
directory-based kinds use the leaf name.
Sourcepub fn from_host_relative(
path: &Path,
root: &Path,
) -> Result<Self, DestPathError>
pub fn from_host_relative( path: &Path, root: &Path, ) -> Result<Self, DestPathError>
Create from a host-relative path by stripping a root prefix. Used for CLI commands that accept filesystem paths.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DestPath
impl<'de> Deserialize<'de> for DestPath
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for DestPath
impl Ord for DestPath
Source§impl PartialOrd for DestPath
impl PartialOrd for DestPath
impl Eq for DestPath
impl StructuralPartialEq for DestPath
Auto Trait Implementations§
impl Freeze for DestPath
impl RefUnwindSafe for DestPath
impl Send for DestPath
impl Sync for DestPath
impl Unpin for DestPath
impl UnsafeUnpin for DestPath
impl UnwindSafe for DestPath
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
Converts
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>
Converts
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