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 kind(&self) -> Kind
Available on crate feature index
only.
pub fn kind(&self) -> Kind
index
only.Returns the kind of hash used in this instance.
sourcepub fn as_slice(&self) -> &[u8] ⓘ
Available on crate feature index
only.
pub fn as_slice(&self) -> &[u8] ⓘ
index
only.Return the raw byte slice representing this hash.
sourcepub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Available on crate feature index
only.
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
index
only.Return the raw mutable byte slice representing this hash.
sourcepub const fn empty_blob(hash: Kind) -> ObjectId
Available on crate feature index
only.
pub const fn empty_blob(hash: Kind) -> ObjectId
index
only.The hash of an empty blob.
sourcepub const fn empty_tree(hash: Kind) -> ObjectId
Available on crate feature index
only.
pub const fn empty_tree(hash: Kind) -> ObjectId
index
only.The hash of an empty tree.
sourcepub const fn null(kind: Kind) -> ObjectId
Available on crate feature index
only.
pub const fn null(kind: Kind) -> ObjectId
index
only.Returns an instances whose bytes are all zero.
sourcepub fn is_null(&self) -> bool
Available on crate feature index
only.
pub fn is_null(&self) -> bool
index
only.Returns true
if this hash consists of all null bytes.
sourcepub fn is_empty_blob(&self) -> bool
Available on crate feature index
only.
pub fn is_empty_blob(&self) -> bool
index
only.Returns true
if this hash is equal to an empty blob.
sourcepub fn is_empty_tree(&self) -> bool
Available on crate feature index
only.
pub fn is_empty_tree(&self) -> bool
index
only.Returns true
if this hash is equal to an empty tree.
impl ObjectId
Sha1 hash specific methods
Methods from Deref<Target = oid>§
sourcepub fn kind(&self) -> Kind
Available on crate feature index
only.
pub fn kind(&self) -> Kind
index
only.The kind of hash used for this instance.
sourcepub fn first_byte(&self) -> u8
Available on crate feature index
only.
pub fn first_byte(&self) -> u8
index
only.The first byte of the hash, commonly used to partition a set of object ids.
sourcepub fn as_bytes(&self) -> &[u8] ⓘ
Available on crate feature index
only.
pub fn as_bytes(&self) -> &[u8] ⓘ
index
only.Interpret this object id as raw byte slice.
sourcepub fn to_hex_with_len(&self, len: usize) -> HexDisplay<'_>
Available on crate feature index
only.
pub fn to_hex_with_len(&self, len: usize) -> HexDisplay<'_>
index
only.Return a type which can display itself in hexadecimal form with the len
amount of characters.
sourcepub fn to_hex(&self) -> HexDisplay<'_>
Available on crate feature index
only.
pub fn to_hex(&self) -> HexDisplay<'_>
index
only.Return a type which displays this oid as hex in full.
sourcepub fn hex_to_buf(&self, buf: &mut [u8]) -> usize
Available on crate feature index
only.
pub fn hex_to_buf(&self, buf: &mut [u8]) -> usize
index
only.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.
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§fn ancestors<Find, E>(
self,
find: Find
) -> Ancestors<Find, fn(_: &oid) -> bool, State>where
Find: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Result<CommitRefIter<'a>, E>,
E: Error + Send + Sync + 'static,
fn ancestors<Find, E>( self, find: Find ) -> Ancestors<Find, fn(_: &oid) -> bool, State>where Find: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Result<CommitRefIter<'a>, E>, E: Error + Send + Sync + 'static,
source§fn attach(self, repo: &Repository) -> Id<'_>
fn attach(self, repo: &Repository) -> Id<'_>
repo
access.source§impl Ord for ObjectId
impl Ord for ObjectId
source§impl PartialEq<&oid> for ObjectId
impl PartialEq<&oid> for ObjectId
source§impl<'repo> PartialEq<Id<'repo>> for ObjectId
impl<'repo> PartialEq<Id<'repo>> for ObjectId
source§impl PartialEq<ObjectId> for &oid
impl PartialEq<ObjectId> for &oid
source§impl<'repo> PartialEq<ObjectId> for Id<'repo>
impl<'repo> PartialEq<ObjectId> for Id<'repo>
source§impl PartialEq<ObjectId> for ObjectId
impl PartialEq<ObjectId> for ObjectId
source§impl PartialOrd<ObjectId> for ObjectId
impl PartialOrd<ObjectId> for ObjectId
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