Enum git_hash::ObjectId [−][src]
An owned hash identifying objects, most commonly Sha1
Variants
Implementations
impl ObjectId
[src]
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
pub const fn empty_tree() -> ObjectId
[src]
impl ObjectId
[src]
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.
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 ObjectId::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 ObjectId::kind()
.
Trait Implementations
impl<'de> Deserialize<'de> 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 PartialOrd<ObjectId> for ObjectId
[src]
impl PartialOrd<ObjectId> for ObjectId
[src]impl StructuralEq for ObjectId
[src]
impl StructuralEq for ObjectId
[src]impl StructuralPartialEq for ObjectId
[src]
impl StructuralPartialEq for ObjectId
[src]Auto Trait Implementations
impl RefUnwindSafe for ObjectId
impl RefUnwindSafe for ObjectId
impl UnwindSafe for ObjectId
impl UnwindSafe for ObjectId