pub struct CommitData<Tree, Parent> { /* private fields */ }Expand description
A git commit in its object description form, i.e. the output of
git cat-file for a commit object.
Implementations§
Source§impl CommitData<Oid, Oid>
 
impl CommitData<Oid, Oid>
Sourcepub fn read(repo: &Repository, oid: Oid) -> Result<CommitData<Oid, Oid>, Read>
 
pub fn read(repo: &Repository, oid: Oid) -> Result<CommitData<Oid, Oid>, Read>
Read the Commit from the repo that is expected to be found at
oid.
Source§impl<Tree, Parent> CommitData<Tree, Parent>
 
impl<Tree, Parent> CommitData<Tree, Parent>
pub fn new<P, I, T>( tree: Tree, parents: P, author: Author, committer: Author, headers: Headers, message: String, trailers: I, ) -> CommitData<Tree, Parent>
Sourcepub fn parents(&self) -> impl Iterator<Item = Parent>where
    Parent: Clone,
 
pub fn parents(&self) -> impl Iterator<Item = Parent>where
    Parent: Clone,
The parents of this commit.
The author of this commit, i.e. the header corresponding to author.
Sourcepub fn committer(&self) -> &Author
 
pub fn committer(&self) -> &Author
The committer of this commit, i.e. the header corresponding to
committer.
Sourcepub fn signatures(&self) -> impl Iterator<Item = Signature<'_>>
 
pub fn signatures(&self) -> impl Iterator<Item = Signature<'_>>
The Signatures found in this commit, i.e. the headers corresponding
to gpgsig.
Sourcepub fn headers(&self) -> impl Iterator<Item = (&str, &str)>
 
pub fn headers(&self) -> impl Iterator<Item = (&str, &str)>
The Headers found in this commit.
Note: these do not include tree, parent, author, and committer.
Sourcepub fn values<'a>(&'a self, name: &'a str) -> impl Iterator<Item = &'a str> + 'a
 
pub fn values<'a>(&'a self, name: &'a str) -> impl Iterator<Item = &'a str> + 'a
Iterate over the Headers values that match the provided name.
Sourcepub fn push_header(&mut self, name: &str, value: &str)
 
pub fn push_header(&mut self, name: &str, value: &str)
Push a header to the end of the headers section.
pub fn trailers(&self) -> impl Iterator<Item = &OwnedTrailer>
Sourcepub fn map_tree<U, E, F>(self, f: F) -> Result<CommitData<U, Parent>, E>
 
pub fn map_tree<U, E, F>(self, f: F) -> Result<CommitData<U, Parent>, E>
Convert the CommitData::tree into a value of type U. The
conversion function f can be fallible.
For example, map_tree can be used to turn raw tree data into
an Oid by writing it to a repository.
Sourcepub fn map_parents<U, E, F>(self, f: F) -> Result<CommitData<Tree, U>, E>
 
pub fn map_parents<U, E, F>(self, f: F) -> Result<CommitData<Tree, U>, E>
Convert the CommitData::parents into a vector containing
values of type U. The conversion function f can be
fallible.
For example, map_parents can be used to resolve the Oids
to their respective git2::Commits.
Trait Implementations§
Source§impl<Tree, Parent> Debug for CommitData<Tree, Parent>
 
impl<Tree, Parent> Debug for CommitData<Tree, Parent>
Auto Trait Implementations§
impl<Tree, Parent> Freeze for CommitData<Tree, Parent>where
    Tree: Freeze,
impl<Tree, Parent> RefUnwindSafe for CommitData<Tree, Parent>where
    Tree: RefUnwindSafe,
    Parent: RefUnwindSafe,
impl<Tree, Parent> Send for CommitData<Tree, Parent>
impl<Tree, Parent> Sync for CommitData<Tree, Parent>
impl<Tree, Parent> Unpin for CommitData<Tree, Parent>
impl<Tree, Parent> UnwindSafe for CommitData<Tree, Parent>where
    Tree: UnwindSafe,
    Parent: UnwindSafe,
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
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>
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>
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 more