#[repr(C)]pub struct Oid { /* private fields */ }
Expand description
Unique identity of any object (commit, tree, blob, tag).
Implementationsยง
Sourceยงimpl Oid
impl Oid
Sourcepub fn from_str(s: &str) -> Result<Oid, Error>
pub fn from_str(s: &str) -> Result<Oid, Error>
Parse a hex-formatted object id into an Oid structure.
ยงErrors
Returns an error if the string is empty, is longer than 40 hex characters, or contains any non-hex characters.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Oid, Error>
pub fn from_bytes(bytes: &[u8]) -> Result<Oid, Error>
Parse a raw object id into an Oid structure.
If the array given is not 20 bytes in length, an error is returned.
Sourcepub fn hash_object(kind: ObjectType, bytes: &[u8]) -> Result<Oid, Error>
pub fn hash_object(kind: ObjectType, bytes: &[u8]) -> Result<Oid, Error>
Hashes the provided data as an object of the provided type, and returns an Oid corresponding to the result. This does not store the object inside any object database or repository.
Trait Implementationsยง
Sourceยงimpl<'q, DB> Encode<'q, DB> for Oid
impl<'q, DB> Encode<'q, DB> for Oid
Sourceยงfn encode_by_ref(
&self,
buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer,
) -> IsNull
fn encode_by_ref( &self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer, ) -> IsNull
Sourceยงfn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNullwhere
Self: Sized,
fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNullwhere
Self: Sized,
Writes the value of
self
into buf
in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
Sourceยงimpl FromStr for Oid
impl FromStr for Oid
Sourceยงimpl Ord for Oid
impl Ord for Oid
Sourceยงimpl PartialOrd for Oid
impl PartialOrd for Oid
impl Copy for Oid
impl Eq for Oid
Auto Trait Implementationsยง
impl Freeze for Oid
impl RefUnwindSafe for Oid
impl Send for Oid
impl Sync for Oid
impl Unpin for Oid
impl UnwindSafe for Oid
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Sourceยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self> โ
fn into_either(self, into_left: bool) -> Either<Self, Self> โ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSourceยงimpl<T> ToHex for T
impl<T> ToHex for T
Sourceยงfn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Sourceยงfn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)