pub struct Sha(/* private fields */);Expand description
SHA-1 object OID, displayed as 40 lowercase hex characters.
Wraps gix_hash::ObjectId to make the wire-format invariant —
lowercase-hex bundle filenames on the bucket — a type-system
property. The wrapper is agnostic to object kind: instances may
hold the OID of a commit, annotated tag, tree, or blob. Callers
that require a commit specifically must peel via
[peel_tag_chain] and match on [PeeledTip].
Implementations§
Source§impl Sha
impl Sha
Sourcepub fn from_hex(hex: &str) -> Result<Self, ShaError>
pub fn from_hex(hex: &str) -> Result<Self, ShaError>
Parse a SHA-1 hex string. Accepts lowercase, uppercase, or mixed
case input and stores it canonically; Display
always emits lowercase.
§Errors
Returns ShaError::Empty if hex is empty, or
ShaError::Decode if the input is the wrong length or contains
non-hex characters.
Sourcepub fn from_object_id(id: ObjectId) -> Self
pub fn from_object_id(id: ObjectId) -> Self
Wrap an existing ObjectId without re-validating.
Sourcepub fn as_object_id(&self) -> &ObjectId
pub fn as_object_id(&self) -> &ObjectId
Borrow the underlying ObjectId.
Trait Implementations§
impl Copy for Sha
impl Eq for Sha
impl StructuralPartialEq for Sha
Auto Trait Implementations§
impl Freeze for Sha
impl RefUnwindSafe for Sha
impl Send for Sha
impl Sync for Sha
impl Unpin for Sha
impl UnsafeUnpin for Sha
impl UnwindSafe for Sha
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.