Struct git_repository::Id
source · pub struct Id<'r> { /* private fields */ }
Expand description
An ObjectId with access to a repository.
Implementations§
source§impl<'repo> Id<'repo>
impl<'repo> Id<'repo>
An object id infused with Easy
.
sourcepub fn shorten(&self) -> Result<Prefix, Error>
pub fn shorten(&self) -> Result<Prefix, Error>
Turn this object id into a shortened id with a length in hex as configured by core.abbrev
.
sourcepub fn shorten_or_id(&self) -> Prefix
pub fn shorten_or_id(&self) -> Prefix
Turn this object id into a shortened id with a length in hex as configured by core.abbrev
, or default
to a prefix which equals our id in the unlikely error case.
source§impl<'repo> Id<'repo>
impl<'repo> Id<'repo>
sourcepub fn ancestors(&self) -> Platform<'repo>
pub fn ancestors(&self) -> Platform<'repo>
Obtain a platform for traversing ancestors of this commit.
Note that unless error_on_missing_commit()
is enabled, which be default it is not,
one will always see an empty iteration even if this id is not a commit, instead of an error.
If this is undesirable, it’s best to check for the correct object type before creating an iterator.
Methods from Deref<Target = oid>§
sourcepub fn first_byte(&self) -> u8
pub fn first_byte(&self) -> u8
The first byte of the hash, commonly used to partition a set of Id
s
sourcepub fn to_hex_with_len(&self, len: usize) -> HexDisplay<'_>
pub fn to_hex_with_len(&self, len: usize) -> HexDisplay<'_>
Return a type which can display itself in hexadecimal form with the len
amount of characters.
sourcepub fn hex_to_buf(&self, buf: &mut [u8]) -> usize
pub fn hex_to_buf(&self, buf: &mut [u8]) -> usize
Write ourselves to the out
in hexadecimal notation, returning the amount of written bytes.
Panics if the buffer isn’t big enough to hold twice as many bytes as the current binary size.
Trait Implementations§
source§impl<'repo> PartialEq<Id<'repo>> for Id<'repo>
impl<'repo> PartialEq<Id<'repo>> for Id<'repo>
source§impl<'repo> PartialEq<Id<'repo>> for ObjectId
impl<'repo> PartialEq<Id<'repo>> for ObjectId
source§impl<'repo> PartialEq<Object<'repo>> for Id<'repo>
impl<'repo> PartialEq<Object<'repo>> for Id<'repo>
source§impl<'repo> PartialEq<ObjectDetached> for Id<'repo>
impl<'repo> PartialEq<ObjectDetached> for Id<'repo>
source§fn eq(&self, other: &ObjectDetached) -> bool
fn eq(&self, other: &ObjectDetached) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<'repo> PartialEq<ObjectId> for Id<'repo>
impl<'repo> PartialEq<ObjectId> for Id<'repo>
source§impl<'a> PartialOrd<Id<'a>> for Id<'a>
impl<'a> PartialOrd<Id<'a>> for Id<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl<'r> Copy for Id<'r>
Auto Trait Implementations§
impl<'r> !RefUnwindSafe for Id<'r>
impl<'r> !Send for Id<'r>
impl<'r> !Sync for Id<'r>
impl<'r> Unpin for Id<'r>
impl<'r> !UnwindSafe for Id<'r>
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
]. Read more