Enum gitoxide_core::pack::receive::ObjectId
pub enum ObjectId {
Sha1([u8; 20]),
}
async-client
or blocking-client
only.Expand description
An owned hash identifying objects, most commonly Sha1
Variants§
Implementations§
§impl ObjectId
impl ObjectId
Access and conversion
pub fn kind(&self) -> Kind
pub fn kind(&self) -> Kind
Returns the kind of hash used in this instance.
pub 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.
pub const fn empty_blob(hash: Kind) -> ObjectId
pub const fn empty_blob(hash: Kind) -> ObjectId
The hash of an empty blob.
pub const fn empty_tree(hash: Kind) -> ObjectId
pub const fn empty_tree(hash: Kind) -> ObjectId
The hash of an empty tree.
pub fn is_empty_blob(&self) -> bool
pub fn is_empty_blob(&self) -> bool
Returns true
if this hash is equal to an empty blob.
pub fn is_empty_tree(&self) -> bool
pub fn is_empty_tree(&self) -> bool
Returns true
if this hash is equal to an empty tree.
§impl ObjectId
impl ObjectId
Lifecycle
pub 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>§
pub fn kind(&self) -> Kind
pub fn kind(&self) -> Kind
The kind of hash used for this instance.
pub 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.
pub 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.
pub fn to_hex(&self) -> HexDisplay<'_>
pub fn to_hex(&self) -> HexDisplay<'_>
Return a type which displays this oid as hex in full.
pub 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.
pub fn write_hex_to(&self, out: &mut dyn Write) -> Result<(), Error>
pub fn write_hex_to(&self, out: &mut dyn Write) -> Result<(), Error>
Write ourselves to out
in hexadecimal notation.
Trait Implementations§
§impl<'de> Deserialize<'de> for ObjectId
impl<'de> Deserialize<'de> for ObjectId
§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
§impl Ord for ObjectId
impl Ord for ObjectId
source§impl<'repo> PartialEq<Id<'repo>> for ObjectId
impl<'repo> PartialEq<Id<'repo>> for ObjectId
§impl PartialOrd for ObjectId
impl PartialOrd for ObjectId
§fn partial_cmp(&self, other: &ObjectId) -> Option<Ordering>
fn partial_cmp(&self, other: &ObjectId) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more