Struct git_object::immutable::commit::Commit[][src]

pub struct Commit<'a> {
    pub tree: &'a BStr,
    pub parents: SmallVec<[&'a BStr; 2]>,
    pub author: Signature<'a>,
    pub committer: Signature<'a>,
    pub encoding: Option<&'a BStr>,
    pub message: &'a BStr,
    pub extra_headers: Vec<(&'a BStr, Cow<'a, BStr>)>,
}

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.

author: Signature<'a>

Who wrote this commit.

committer: Signature<'a>

Who committed this commit.

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

impl<'a> Commit<'a>[src]

pub fn from_bytes(data: &'a [u8]) -> Result<Commit<'a>, Error>[src]

Deserialize a commit from the given data bytes while avoiding most allocations.

pub fn tree(&self) -> ObjectId[src]

Return the tree fields hash digest.

pub fn parents(&self) -> impl Iterator<Item = ObjectId> + '_[src]

Returns an iterator of parent object ids

pub fn extra_headers(
    &self
) -> ExtraHeaders<impl Iterator<Item = (&BStr, &BStr)>>
[src]

Returns a convenient iterator over all extra headers.

Trait Implementations

impl<'a> Clone for Commit<'a>[src]

impl<'a> Debug for Commit<'a>[src]

impl<'de: 'a, 'a> Deserialize<'de> for Commit<'a>[src]

impl<'a> Eq for Commit<'a>[src]

impl From<Commit<'_>> for Commit[src]

impl<'a> From<Commit<'a>> for Object<'a>[src]

impl<'a> Hash for Commit<'a>[src]

impl<'a> Ord for Commit<'a>[src]

impl<'a> PartialEq<Commit<'a>> for Commit<'a>[src]

impl<'a> PartialOrd<Commit<'a>> for Commit<'a>[src]

impl<'a> Serialize for Commit<'a>[src]

impl<'a> StructuralEq for Commit<'a>[src]

impl<'a> StructuralPartialEq for Commit<'a>[src]

impl<'a> TryFrom<Object<'a>> for Commit<'a>[src]

type Error = Object<'a>

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Commit<'a>

impl<'a> Send for Commit<'a>

impl<'a> Sync for Commit<'a>

impl<'a> Unpin for Commit<'a>

impl<'a> UnwindSafe for Commit<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.