Skip to main content

Commit

Struct Commit 

Source
pub struct Commit<'repo> { /* private fields */ }
Expand description

A singular git commit for the repository being inspected

Implementations§

Source§

impl<'repo> Commit<'repo>

Source

pub fn new(commit: Commit<'repo>, repository: &'repo Repository) -> Self

Instantiate a new Commit object from a git2 commit

Source

pub fn hash(&self) -> String

Return the commit hash

Source

pub fn msg(&self) -> Option<String>

Return the commit message if it exists

Source

pub fn author(&self) -> Actor

Return the commit author

Source

pub fn committer(&self) -> Actor

Return the commit committer

Source

pub fn parents(&self) -> impl Iterator<Item = String>

Retrun the hashes of all commit parents

Source

pub fn is_merge(&self) -> bool

Return whether the commit is a merge commit

Source

pub fn mod_files(&self) -> Result<impl Iterator<Item = ModifiedFile<'_>>, Error>

Return an iterator over the modified files that belong to a commit

Source

pub fn insertions(&self) -> Result<usize, Error>

The number of insertions in the commit

Source

pub fn deletions(&self) -> Result<usize, Error>

The number of deletions in the commit

Source

pub fn lines(&self) -> Result<usize, Error>

The total number of lines modified in the commit

Source

pub fn files(&self) -> Result<usize, Error>

The number of files modified in the commit

Auto Trait Implementations§

§

impl<'repo> !Freeze for Commit<'repo>

§

impl<'repo> !RefUnwindSafe for Commit<'repo>

§

impl<'repo> !Send for Commit<'repo>

§

impl<'repo> !Sync for Commit<'repo>

§

impl<'repo> Unpin for Commit<'repo>

§

impl<'repo> UnsafeUnpin for Commit<'repo>

§

impl<'repo> UnwindSafe for Commit<'repo>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.