#[repr(C)]pub struct Oid { /* private fields */ }
Expand description
Unique identity of any object (commit, tree, blob, tag).
Implementations
sourceimpl 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.
sourcepub fn hash_file<P: AsRef<Path>>(
kind: ObjectType,
path: P
) -> Result<Oid, Error>
pub fn hash_file<P: AsRef<Path>>(
kind: ObjectType,
path: P
) -> Result<Oid, Error>
Hashes the content of the provided file 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
sourceimpl Ord for Oid
impl Ord for Oid
sourceimpl PartialOrd<Oid> for Oid
impl PartialOrd<Oid> for Oid
sourcefn partial_cmp(&self, other: &Oid) -> Option<Ordering>
fn partial_cmp(&self, other: &Oid) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Oid
impl Eq for Oid
Auto Trait Implementations
impl RefUnwindSafe for Oid
impl Send for Oid
impl Sync for Oid
impl Unpin for Oid
impl UnwindSafe for Oid
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more