Enum git_repository::ObjectId
source · [−]Expand description
An owned hash identifying objects, most commonly Sha1
Variants
Sha1([u8; 20])
A SHA 1 hash digest
Implementations
sourceimpl ObjectId
impl ObjectId
Access and conversion
sourcepub fn as_slice(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn as_slice(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Return the raw byte slice representing this hash
sourcepub fn as_mut_slice(&mut self) -> &mut [u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn as_mut_slice(&mut self) -> &mut [u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Return the raw mutable byte slice representing this hash
sourcepub const fn empty_tree(hash: Kind) -> ObjectId
pub const fn empty_tree(hash: Kind) -> ObjectId
The hash of an empty tree
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 Id
s
sourcepub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Interpret this object id as raw byte slice.
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.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for ObjectId
impl<'de> Deserialize<'de> for ObjectId
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl ObjectIdExt for ObjectId
impl ObjectIdExt for ObjectId
sourcefn 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,
Create an iterator over the ancestry of the commits reachable from this id, which must be a commit.
sourcefn attach(self, repo: &Repository) -> Id<'_>
fn attach(self, repo: &Repository) -> Id<'_>
Infuse this object id repo
access.
sourceimpl Ord for ObjectId
impl Ord for ObjectId
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<&oid> for ObjectId
impl PartialEq<&oid> for ObjectId
sourceimpl<'repo> PartialEq<Id<'repo>> for ObjectId
impl<'repo> PartialEq<Id<'repo>> for ObjectId
sourceimpl PartialEq<ObjectId> for &oid
impl PartialEq<ObjectId> for &oid
sourceimpl<'repo> PartialEq<ObjectId> for Id<'repo>
impl<'repo> PartialEq<ObjectId> for Id<'repo>
sourceimpl PartialEq<ObjectId> for ObjectId
impl PartialEq<ObjectId> for ObjectId
sourceimpl PartialOrd<ObjectId> for ObjectId
impl PartialOrd<ObjectId> for ObjectId
sourcefn partial_cmp(&self, other: &ObjectId) -> Option<Ordering>
fn partial_cmp(&self, other: &ObjectId) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
sourceimpl Serialize for ObjectId
impl Serialize for ObjectId
sourcefn 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,
Serialize this value into the given Serde serializer. Read more
impl Copy for ObjectId
impl Eq for ObjectId
impl StructuralEq for ObjectId
impl StructuralPartialEq for ObjectId
Auto Trait Implementations
impl RefUnwindSafe for ObjectId
impl Send for ObjectId
impl Sync for ObjectId
impl Unpin for ObjectId
impl UnwindSafe for ObjectId
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> ToCompactString for T where
T: Display,
impl<T> ToCompactString for T where
T: Display,
fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a [CompactString
]. Read more