Struct Commit

Source
pub struct Commit { /* 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 Commit

Source

pub fn new<I, T>( tree: Oid, parents: Vec<Oid>, author: Author, committer: Author, headers: Headers, message: String, trailers: I, ) -> Self
where I: IntoIterator<Item = T>, OwnedTrailer: From<T>,

Source

pub fn read(repo: &Repository, oid: Oid) -> Result<Self, Read>

Read the Commit from the repo that is expected to be found at oid.

Source

pub fn write(&self, repo: &Repository) -> Result<Oid, Error>

Write the given Commit to the repo. The resulting Oid is the identifier for this commit.

Source

pub fn tree(&self) -> Oid

The tree Oid this commit points to.

Source

pub fn parents(&self) -> impl Iterator<Item = Oid> + '_

The parent Oids of this commit.

Source

pub fn author(&self) -> &Author

The author of this commit, i.e. the header corresponding to author.

Source

pub fn committer(&self) -> &Author

The committer of this commit, i.e. the header corresponding to committer.

Source

pub fn message(&self) -> &str

The message body of this commit.

Source

pub fn signatures(&self) -> impl Iterator<Item = Signature<'_>> + '_

The Signatures found in this commit, i.e. the headers corresponding to gpgsig.

Source

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.

Source

pub fn values<'a>(&'a self, name: &'a str) -> impl Iterator<Item = &'a str> + '_

Iterate over the Headers values that match the provided name.

Source

pub fn push_header(&mut self, name: &str, value: &str)

Push a header to the end of the headers section.

Source

pub fn trailers(&self) -> impl Iterator<Item = &OwnedTrailer>

Trait Implementations§

Source§

impl Debug for Commit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for Commit

Source§

type Err = Parse

The associated error which can be returned from parsing.
Source§

fn from_str(buffer: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl ToString for Commit

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl TryFrom<&[u8]> for Commit

Source§

type Error = Parse

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

fn try_from(data: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Buf> for Commit

Source§

type Error = Parse

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

fn try_from(value: Buf) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Commit

§

impl RefUnwindSafe for Commit

§

impl Send for Commit

§

impl Sync for Commit

§

impl Unpin for Commit

§

impl UnwindSafe for Commit

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T