[−][src]Struct git_object::owned::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][+]
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][+]
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,
impl<T> Conv for T
[+]
impl<T> Conv for T
[+]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> FmtForward for T
[+]
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> Pipe for T where
T: ?Sized,
[+]
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,
[+]
U: ?Sized,
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
[+]
U: ?Sized,
impl<T> TapDeref for T
[+]
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src][+]
T: Display + ?Sized,
impl<T> TryConv for T
[+]
impl<T> TryConv for T
[+]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,