pub enum ObjectId {
Sha1([u8; 20]),
}async-client or blocking-client only.Expand description
An owned hash identifying objects, most commonly Sha1
Variants§
Implementations§
Source§impl ObjectId
Access and conversion
impl ObjectId
Access and conversion
Sourcepub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Return the raw mutable byte slice representing this hash.
Sourcepub const fn empty_blob(hash: Kind) -> ObjectId
pub const fn empty_blob(hash: Kind) -> ObjectId
The hash of an empty blob.
Sourcepub const fn empty_tree(hash: Kind) -> ObjectId
pub const fn empty_tree(hash: Kind) -> ObjectId
The hash of an empty tree.
Sourcepub fn is_empty_blob(&self) -> bool
pub fn is_empty_blob(&self) -> bool
Returns true if this hash is equal to an empty blob.
Sourcepub fn is_empty_tree(&self) -> bool
pub fn is_empty_tree(&self) -> bool
Returns true if this hash is equal to an empty tree.
Source§impl ObjectId
Lifecycle
impl ObjectId
Lifecycle
Sourcepub fn from_bytes_or_panic(bytes: &[u8]) -> ObjectId
pub fn from_bytes_or_panic(bytes: &[u8]) -> ObjectId
Convert bytes into an owned object Id or panic if the slice length doesn’t indicate a supported hash.
Use Self::try_from(bytes) for a fallible version.
impl ObjectId
Sha1 hash specific methods
Methods from Deref<Target = oid>§
Sourcepub fn first_byte(&self) -> u8
pub fn first_byte(&self) -> u8
The first byte of the hash, commonly used to partition a set of object ids.
Sourcepub fn to_hex_with_len(&self, len: usize) -> HexDisplay<'_>
pub fn to_hex_with_len(&self, len: usize) -> HexDisplay<'_>
Return a type which can display itself in hexadecimal form with the len amount of characters.
Sourcepub fn hex_to_buf<'a>(&self, buf: &'a mut [u8]) -> &'a mut str
pub fn hex_to_buf<'a>(&self, buf: &'a mut [u8]) -> &'a mut str
Write ourselves to the out in hexadecimal notation, returning the hex-string ready for display.
Panics if the buffer isn’t big enough to hold twice as many bytes as the current binary size.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ObjectId
impl<'de> Deserialize<'de> for ObjectId
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ObjectId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ObjectId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl ObjectIdExt for ObjectId
impl ObjectIdExt for ObjectId
Source§impl Ord for ObjectId
impl Ord for ObjectId
Source§impl PartialOrd for ObjectId
impl PartialOrd for ObjectId
Source§impl Serialize for ObjectId
impl Serialize for ObjectId
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for ObjectId
impl Eq for ObjectId
impl StructuralPartialEq for ObjectId
Auto Trait Implementations§
impl Freeze for ObjectId
impl RefUnwindSafe for ObjectId
impl Send for ObjectId
impl Sync for ObjectId
impl Unpin for ObjectId
impl UnwindSafe for ObjectId
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 more