pub struct RepoId(/* private fields */);Expand description
Stable identifier for a repository family — shared across all worktrees and clones of the same repository.
Derived from the SHA-1 of the first (root) commit, or a SHA-256 hash of the canonical directory path when Git is unavailable.
Implementations§
Source§impl RepoId
impl RepoId
Sourcepub fn for_path(path: &Path) -> Result<Self, StorageError>
pub fn for_path(path: &Path) -> Result<Self, StorageError>
Compute the RepoId for the repository that contains path.
Runs git rev-list --max-parents=0 HEAD in the directory. Falls back
to sha256(canonical_path) if Git is not installed or the directory is
not a Git repository.
§Errors
Returns StorageError::Io if the path cannot be canonicalised.
Sourcepub fn from_string(s: impl Into<String>) -> Self
pub fn from_string(s: impl Into<String>) -> Self
Create a RepoId from a pre-computed string value.
Useful for deserialising stored identifiers.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RepoId
impl<'de> Deserialize<'de> for RepoId
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
impl Eq for RepoId
impl StructuralPartialEq for RepoId
Auto Trait Implementations§
impl Freeze for RepoId
impl RefUnwindSafe for RepoId
impl Send for RepoId
impl Sync for RepoId
impl Unpin for RepoId
impl UnsafeUnpin for RepoId
impl UnwindSafe for RepoId
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.