Struct git_object::CommitRef
source · [−]pub struct CommitRef<'a> {
pub tree: &'a BStr,
pub parents: SmallVec<[&'a BStr; 2]>,
pub author: SignatureRef<'a>,
pub committer: SignatureRef<'a>,
pub encoding: Option<&'a BStr>,
pub message: &'a BStr,
pub extra_headers: Vec<(&'a BStr, Cow<'a, BStr>)>,
}
Expand description
A git commit parsed using from_bytes()
.
A commit encapsulates information about a point in time at which the state of the repository is recorded, usually after a
change which is documented in the commit message
.
Fields
tree: &'a BStr
HEX hash of tree object we point to. Usually 40 bytes long.
Use tree()
to obtain a decoded version of it.
parents: SmallVec<[&'a BStr; 2]>
HEX hash of each parent commit. Empty for first commit in repository.
Who wrote this commit. Name and email might contain whitespace and are not trimmed to ensure round-tripping.
Use the author()
method to received a trimmed version of it.
committer: SignatureRef<'a>
Who committed this commit. Name and email might contain whitespace and are not trimmed to ensure round-tripping.
Use the committer()
method to received a trimmed version of it.
This may be different from the author
in case the author couldn’t write to the repository themselves and
is commonly encountered with contributed commits.
encoding: Option<&'a BStr>
The name of the message encoding, otherwise UTF-8 should be assumed.
message: &'a BStr
The commit message documenting the change.
extra_headers: Vec<(&'a BStr, Cow<'a, BStr>)>
Extra header fields, in order of them being encountered, made accessible with the iterator returned by extra_headers()
.
Implementations
sourceimpl<'a> CommitRef<'a>
impl<'a> CommitRef<'a>
sourcepub fn message_summary(&self) -> Cow<'a, BStr>
pub fn message_summary(&self) -> Cow<'a, BStr>
Return exactly the same message as MessageRef::summary()
.
sourcepub fn message_trailers(&self) -> Trailers<'a>ⓘNotable traits for Trailers<'a>impl<'a> Iterator for Trailers<'a> type Item = TrailerRef<'a>;
pub fn message_trailers(&self) -> Trailers<'a>ⓘNotable traits for Trailers<'a>impl<'a> Iterator for Trailers<'a> type Item = TrailerRef<'a>;
Return an iterator over message trailers as obtained from the last paragraph of the commit message. May be empty.
sourceimpl<'a> CommitRef<'a>
impl<'a> CommitRef<'a>
sourcepub fn from_bytes(data: &'a [u8]) -> Result<CommitRef<'a>, Error>
pub fn from_bytes(data: &'a [u8]) -> Result<CommitRef<'a>, Error>
Deserialize a commit from the given data
bytes while avoiding most allocations.
sourcepub fn parents(&self) -> impl Iterator<Item = ObjectId> + '_
pub fn parents(&self) -> impl Iterator<Item = ObjectId> + '_
Returns an iterator of parent object ids
sourcepub fn extra_headers(
&self
) -> ExtraHeaders<impl Iterator<Item = (&BStr, &BStr)>>
pub fn extra_headers(
&self
) -> ExtraHeaders<impl Iterator<Item = (&BStr, &BStr)>>
Returns a convenient iterator over all extra headers.
Return the author, with whitespace trimmed.
This is different from the author
field which may contain whitespace.
sourcepub fn committer(&self) -> SignatureRef<'a>
pub fn committer(&self) -> SignatureRef<'a>
Return the committer, with whitespace trimmed.
This is different from the committer
field which may contain whitespace.
sourcepub fn message(&self) -> MessageRef<'a>
pub fn message(&self) -> MessageRef<'a>
Returns a partially parsed message from which more information can be derived.
Trait Implementations
sourceimpl<'de: 'a, 'a> Deserialize<'de> for CommitRef<'a>
impl<'de: 'a, 'a> Deserialize<'de> for CommitRef<'a>
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a> Ord for CommitRef<'a>
impl<'a> Ord for CommitRef<'a>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<'a> PartialOrd<CommitRef<'a>> for CommitRef<'a>
impl<'a> PartialOrd<CommitRef<'a>> for CommitRef<'a>
sourcefn partial_cmp(&self, other: &CommitRef<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &CommitRef<'a>) -> 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
sourceimpl<'a> WriteTo for CommitRef<'a>
impl<'a> WriteTo for CommitRef<'a>
impl<'a> Eq for CommitRef<'a>
impl<'a> StructuralEq for CommitRef<'a>
impl<'a> StructuralPartialEq for CommitRef<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for CommitRef<'a>
impl<'a> Send for CommitRef<'a>
impl<'a> Sync for CommitRef<'a>
impl<'a> Unpin for CommitRef<'a>
impl<'a> UnwindSafe for CommitRef<'a>
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