pub struct WorktreeId(/* private fields */);Expand description
An identifier for one checkout, used as the last component of a layer key.
It is an opaque token rather than a path on purpose: a layer key is stored and printed, and a local filesystem path is user-identifying data that has no business in a record. Producers derive it however they like (a digest of the canonical worktree path is the obvious choice); this type only guarantees the token is well-formed, so a layer key can never be ambiguous.
Implementations§
Source§impl WorktreeId
impl WorktreeId
Sourcepub fn new(raw: &str) -> Result<Self, FindingsError>
pub fn new(raw: &str) -> Result<Self, FindingsError>
Validate and wrap a worktree id: 1..=64 characters of [a-z0-9-].
§Errors
Returns FindingsError::InvalidWorktreeId if raw is empty, too long,
or contains anything else.
Trait Implementations§
Source§impl Clone for WorktreeId
impl Clone for WorktreeId
Source§fn clone(&self) -> WorktreeId
fn clone(&self) -> WorktreeId
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorktreeId
impl Debug for WorktreeId
Source§impl Display for WorktreeId
impl Display for WorktreeId
impl Eq for WorktreeId
Source§impl Ord for WorktreeId
impl Ord for WorktreeId
Source§fn cmp(&self, other: &WorktreeId) -> Ordering
fn cmp(&self, other: &WorktreeId) -> Ordering
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
Source§impl PartialEq for WorktreeId
impl PartialEq for WorktreeId
Source§impl PartialOrd for WorktreeId
impl PartialOrd for WorktreeId
Source§impl Serialize for WorktreeId
impl Serialize for WorktreeId
impl StructuralPartialEq for WorktreeId
Auto Trait Implementations§
impl Freeze for WorktreeId
impl RefUnwindSafe for WorktreeId
impl Send for WorktreeId
impl Sync for WorktreeId
impl Unpin for WorktreeId
impl UnsafeUnpin for WorktreeId
impl UnwindSafe for WorktreeId
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.