pub struct WorkspacePath { /* private fields */ }Expand description
A root-relative path validated for workspace operations.
Implementations§
Source§impl WorkspacePath
impl WorkspacePath
Sourcepub fn parse(path: impl AsRef<str>) -> Result<Self, WorkspaceError>
pub fn parse(path: impl AsRef<str>) -> Result<Self, WorkspaceError>
Parses a model- or user-facing path as a root-relative workspace path.
Absolute paths, . and .. traversal, empty components, NUL bytes,
Windows-style separators, and platform roots or prefixes are rejected.
§Errors
Returns WorkspaceError::InvalidPath when the path is not a safe
root-relative path.
Sourcepub fn join(&self, path: impl AsRef<str>) -> Result<Self, WorkspaceError>
pub fn join(&self, path: impl AsRef<str>) -> Result<Self, WorkspaceError>
Appends a single relative component path and validates the result.
§Errors
Returns WorkspaceError::InvalidPath if the resulting path would no
longer be a valid workspace path.
Trait Implementations§
Source§impl Clone for WorkspacePath
impl Clone for WorkspacePath
Source§impl Debug for WorkspacePath
impl Debug for WorkspacePath
Source§impl<'de> Deserialize<'de> for WorkspacePath
impl<'de> Deserialize<'de> for WorkspacePath
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for WorkspacePath
impl Display for WorkspacePath
impl Eq for WorkspacePath
Source§impl Hash for WorkspacePath
impl Hash for WorkspacePath
Source§impl Ord for WorkspacePath
impl Ord for WorkspacePath
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for WorkspacePath
impl PartialEq for WorkspacePath
Source§impl PartialOrd for WorkspacePath
impl PartialOrd for WorkspacePath
Source§impl Serialize for WorkspacePath
impl Serialize for WorkspacePath
impl StructuralPartialEq for WorkspacePath
Auto Trait Implementations§
impl Freeze for WorkspacePath
impl RefUnwindSafe for WorkspacePath
impl Send for WorkspacePath
impl Sync for WorkspacePath
impl Unpin for WorkspacePath
impl UnsafeUnpin for WorkspacePath
impl UnwindSafe for WorkspacePath
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
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.