[][src]Struct git_hash::borrowed::Digest

pub struct Digest<'a>(_);

A borrowed reference to a hash identifying objects.

Implementations

impl<'a> Digest<'a>[src]

Access

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 Digests

impl<'a> Digest<'a>[src]

Sha1 specific methods

pub fn to_sha1_hex(&self) -> [u8; 40][src]

Returns an array with a hexadecimal encoded version of the Sha1 hash this Digest represents.

Panics if this is not a Sha1 hash, as identifiable by Digest::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 Digest::kind().

pub fn null_sha1() -> Self[src]

Returns a Sha1 digest with all bytes being initialized to zero.

Trait Implementations

impl<'a> Clone for Digest<'a>[src]

impl<'a> Copy for Digest<'a>[src]

impl<'a> Debug for Digest<'a>[src]

impl<'de: 'a, 'a> Deserialize<'de> for Digest<'a>[src]

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.

impl Display for Digest<'_>[src]

impl<'a> Eq for Digest<'a>[src]

impl<'a> From<&'a [u8; 20]> for Digest<'a>[src]

impl<'a> From<Digest<'a>> for Digest[src]

impl<'a> Hash for Digest<'a>[src]

impl<'a> Ord for Digest<'a>[src]

impl<'a> PartialEq<Digest<'a>> for Digest<'a>[src]

impl<'a> PartialOrd<Digest<'a>> for Digest<'a>[src]

impl<'a> Serialize for Digest<'a>[src]

impl<'a> StructuralEq for Digest<'a>[src]

impl<'a> StructuralPartialEq for Digest<'a>[src]

impl<'a> TryFrom<&'a [u8]> for Digest<'a>[src]

type Error = TryFromSliceError

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Digest<'a>[src]

impl<'a> Send for Digest<'a>[src]

impl<'a> Sync for Digest<'a>[src]

impl<'a> Unpin for Digest<'a>[src]

impl<'a> UnwindSafe for Digest<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.