Struct git_hash::oid [−][src]
#[repr(transparent)]pub struct oid { /* fields omitted */ }
Expand description
A borrowed reference to a hash identifying objects.
Future Proofing
In case we wish to support multiple hashes with the same length we cannot discriminate
using the slice length anymore. To make that work, we will use the high bits of the
internal bytes
slice length (a fat pointer, pointing to data and its length in bytes)
to encode additinoal information. Before accessing or returning the bytes, a new adjusted
slice will be constructed, while the high bits will be used to help resolving the
hash [
kind()][oid::kind()]
.
We expect to have quite a few bits available for such ‘conflict resolution’ as most hashes aren’t longer
than 64 bytes.
Implementations
Access
Sha1 specific methods
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()
.
Returns the bytes making up the Sha1.
Panics if this is not a Sha1 hash, as identifiable by ObjectId::kind()
.
Trait Implementations
Manually created from a version that uses a slice, and we forcefully try to convert it into a borrowed array of the desired size Could be improved by fitting this into serde Unfortunately the serde::Deserialize derive wouldn’t work for borrowed arrays.
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for oid
impl UnwindSafe for oid