pub struct WorktreeId {
pub repo_id: RepoId,
pub worktree_hash: String,
pub display_name: String,
}Expand description
Stable identifier for a specific working copy (worktree) within a repository family.
Combines the RepoId with a SHA-256 of the canonicalised worktree root.
Fields§
§repo_id: RepoIdRepository-level identity (shared across worktrees).
worktree_hash: StringPer-worktree discriminator derived from the canonicalised root path.
display_name: StringHuman-readable display name (<repo_name>@<branch>).
Implementations§
Source§impl WorktreeId
impl WorktreeId
Sourcepub fn for_path(path: &Path) -> Result<Self, StorageError>
pub fn for_path(path: &Path) -> Result<Self, StorageError>
Compute the WorktreeId for the worktree that contains path.
Runs git rev-parse --show-toplevel to find the worktree root, then
computes the repo identity and the per-worktree hash.
§Errors
Returns StorageError::Io if the path cannot be canonicalised.
Sourcepub const fn from_parts(
repo_id: RepoId,
worktree_hash: String,
display_name: String,
) -> Self
pub const fn from_parts( repo_id: RepoId, worktree_hash: String, display_name: String, ) -> Self
Create a WorktreeId from pre-computed components.
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 · 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<'de> Deserialize<'de> for WorktreeId
impl<'de> Deserialize<'de> for WorktreeId
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 WorktreeId
impl Display for WorktreeId
Source§impl Hash for WorktreeId
impl Hash for WorktreeId
Source§impl PartialEq for WorktreeId
impl PartialEq for WorktreeId
Source§impl Serialize for WorktreeId
impl Serialize for WorktreeId
impl Eq 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> 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§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.