Struct radicle_git_ext::commit::CommitData

source ·
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>

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, Write>

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

source§

impl<Tree, Parent> CommitData<Tree, Parent>

source

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

source

pub fn tree(&self) -> &Tree

The tree this commit points to.

source

pub fn parents(&self) -> impl Iterator<Item = Parent> + '_
where Parent: Clone,

The parents 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>

source

pub fn map_tree<U, E, F>(self, f: F) -> Result<CommitData<U, Parent>, E>
where F: FnOnce(Tree) -> Result<U, 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.

source

pub fn map_parents<U, E, F>(self, f: F) -> Result<CommitData<Tree, U>, E>
where F: FnMut(Parent) -> Result<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: Debug, Parent: Debug> Debug for CommitData<Tree, Parent>

source§

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

Formats the value using the given formatter. Read more

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>
where Tree: Send, Parent: Send,

§

impl<Tree, Parent> Sync for CommitData<Tree, Parent>
where Tree: Sync, Parent: Sync,

§

impl<Tree, Parent> Unpin for CommitData<Tree, Parent>
where Tree: Unpin, Parent: Unpin,

§

impl<Tree, Parent> UnwindSafe for CommitData<Tree, Parent>
where Tree: UnwindSafe, Parent: UnwindSafe,

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.