Enum git_hash::ObjectId [−][src]
An owned hash identifying objects, most commonly Sha1
Variants
Implementations
impl ObjectId
[src]
Access and conversion
pub fn kind(&self) -> Kind
[src]
Returns the kind of hash used in this Id
pub fn as_slice(&self) -> &[u8]
[src]
Return the raw byte slice representing this hash
pub fn as_mut_slice(&mut self) -> &mut [u8]
[src]
Return the raw mutable byte slice representing this hash
pub fn write_hex_to(&self, out: impl Write) -> Result<()>
[src]
Write ourselves to out
in hexadecimal notation
impl ObjectId
[src]
Sha1 hash specific methods
pub fn sha1(&self) -> &[u8; 20]
[src]
Returns ourselves as slice of 20 bytes.
Panics if this instance is not a sha1 hash.
pub fn to_sha1_hex(&self) -> [u8; 40]
[src]
Return ourselves as array of 40 hexadecimal bytes.
Panics if this instance is not a sha1 hash.
pub fn to_sha1_hex_string(&self) -> String
[src]
Return ourselves as hexadecimal string with a length of 40 bytes.
Panics if this instance is not a sha1 hash.
pub fn new_sha1(id: [u8; 20]) -> Self
[src]
Instantiate an Digest from 20 bytes of a Sha1 digest.
pub fn from_20_bytes(b: &[u8]) -> ObjectId
[src]
Instantiate an Digest from a slice 20 borrowed bytes of a Sha1 digest.
Panics of the slice doesn’t have a length of 20.
pub fn from_borrowed_sha1(b: &[u8; 20]) -> ObjectId
[src]
Instantiate an Digest from a borrowed array of 20 bytes of a Sha1 digest.
pub fn null_sha1() -> ObjectId
[src]
Returns an Digest representing a Sha1 with whose memory is zeroed.
impl ObjectId
[src]
Hash decoding
pub fn from_hex(buffer: &[u8]) -> Result<ObjectId, Error>
[src]
Create an instance from a buffer
of 40 bytes encoded with hexadecimal notation.
Such a buffer can be obtained using [write_hex_to(buffer)
][Id::write_hex_to()]
Methods from Deref<Target = oid>
pub fn kind(&self) -> Kind
[src]
The kind of hash used for this Digest
pub fn first_byte(&self) -> u8
[src]
The first byte of the hash, commonly used to partition a set of Id
s
pub fn as_bytes(&self) -> &[u8]
[src]
pub fn to_sha1_hex(&self) -> [u8; 40]
[src]
Returns an array with a hexadecimal encoded version of the Sha1 hash this Id
represents.
Panics if this is not a Sha1 hash, as identifiable by [Id::kind()
].
pub fn sha1(&self) -> &[u8; 20]
[src]
Returns the bytes making up the Sha1.
Panics if this is not a Sha1 hash, as identifiable by [Id::kind()
].
Trait Implementations
impl AsRef<oid> for ObjectId
[src]
impl Borrow<oid> for ObjectId
[src]
impl Clone for ObjectId
[src]
impl Copy for ObjectId
[src]
impl Debug for ObjectId
[src]
impl Deref for ObjectId
[src]
impl<'de> Deserialize<'de> for ObjectId
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for ObjectId
[src]
impl Eq for ObjectId
[src]
impl From<&'_ oid> for ObjectId
[src]
impl From<[u8; 20]> for ObjectId
[src]
impl FromStr for ObjectId
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for ObjectId
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for ObjectId
[src]
fn cmp(&self, other: &ObjectId) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<&'_ oid> for ObjectId
[src]
impl PartialEq<ObjectId> for &oid
[src]
fn eq(&self, other: &ObjectId) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<ObjectId> for ObjectId
[src]
impl PartialOrd<ObjectId> for ObjectId
[src]
fn partial_cmp(&self, other: &ObjectId) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for ObjectId
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for ObjectId
[src]
impl StructuralPartialEq for ObjectId
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,