[][src]Struct git_object::owned::Id

pub struct Id(_);

An owned hash identifying objects, most commonly Sha1

Implementations

impl Id[src]

Access and conversion

pub fn kind(&self) -> HashKind[src]

Returns the kind of hash used in this Id

pub fn to_borrowed(&self) -> Id<'_>[src]

Return a borrowed version of this instance

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 Id[src]

Sha1 hash specific methods

pub fn from_40_bytes_in_hex(buffer: &[u8]) -> Result<Id, 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)

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 Id from 20 bytes of a Sha1 digest.

pub fn from_20_bytes(b: &[u8]) -> Id[src]

Instantiate an Id 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]) -> Id[src]

Instantiate an Id from a borrowed array of 20 bytes of a Sha1 digest.

pub fn null_sha1() -> Id[src]

Returns an Id representing a Sha1 with whose memory is zeroed.

Trait Implementations

impl Clone for Id[src]

impl Copy for Id[src]

impl Debug for Id[src]

impl Deref for Id[src]

type Target = [u8; 20]

The resulting type after dereferencing.

impl<'de> Deserialize<'de> for Id[src]

impl Display for Id[src]

impl Eq for Id[src]

impl From<[u8; 20]> for Id[src]

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

impl Hash for Id[src]

impl Ord for Id[src]

impl PartialEq<Id> for Id[src]

impl PartialOrd<Id> for Id[src]

impl Serialize for Id[src]

impl StructuralEq for Id[src]

impl StructuralPartialEq for Id[src]

Auto Trait Implementations

impl RefUnwindSafe for Id[src]

impl Send for Id[src]

impl Sync for Id[src]

impl Unpin for Id[src]

impl UnwindSafe for Id[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> Conv for T

impl<T> Conv for T

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

impl<T> FmtForward for T

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

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

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

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> TryConv for T

impl<T> TryConv for T

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.