pub enum ObjectId {
Sha1([u8; 20]),
}
Expand description
An owned hash identifying objects, most commonly Sha1
Variants§
Implementations§
source§impl ObjectId
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.
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(&self, buf: &mut [u8]) -> usize
pub fn hex_to_buf(&self, buf: &mut [u8]) -> usize
Write ourselves to the out
in hexadecimal notation, returning the amount of written bytes.
Panics if the buffer isn’t big enough to hold twice as many bytes as the current binary size.
sourcepub fn write_hex_to(&self, out: &mut dyn Write) -> Result<()>
pub fn write_hex_to(&self, out: &mut dyn Write) -> Result<()>
Write ourselves to out
in hexadecimal notation.
Trait Implementations§
source§impl<'de> Deserialize<'de> for ObjectId
impl<'de> Deserialize<'de> for ObjectId
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 Ord for ObjectId
impl Ord for ObjectId
source§impl PartialEq<&oid> for ObjectId
impl PartialEq<&oid> for ObjectId
source§impl PartialEq<ObjectId> for &oid
impl PartialEq<ObjectId> for &oid
source§impl PartialEq for ObjectId
impl PartialEq for ObjectId
source§impl PartialOrd for ObjectId
impl PartialOrd for ObjectId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl 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
Mutably borrows from an owned value. Read more