pub struct GitTestament<'a> {
    pub commit: CommitKind<'a>,
    pub modifications: &'a [GitModification<'a>],
    pub branch_name: Option<&'a str>,
}
Expand description

A testament to the state of a git repository when a crate is built.

This is the type returned by the git_testament_derive::git_testament macro when used to record the state of a git tree when a crate is built.

The structure contains information about the commit from which the crate was built, along with information about any modifications to the working tree which could be considered “dirty” as a result.

By default, the Display implementation for this structure attempts to produce something pleasant but useful to humans. For example it might produce a string along the lines of "1.0.0 (763aa159d 2019-04-02)" for a clean build from a 1.0.0 tag. Alternatively if the working tree is dirty and there have been some commits since the last tag, you might get something more like "1.0.0+14 (651af89ed 2019-04-02) dirty 4 modifications"

If your program wishes to go into more detail, then the commit and the modifications members are available for rendering as the program author sees fit.

In general this is only of use for binaries, since libraries will generally be built from crates.io provided tarballs and as such won’t carry the information needed. In such a fallback position the string will be something along the lines of "x.y (somedate)" where x.y is the crate’s version and somedate is the date of the build. You’ll get similar information if the crate is built in a git repository on a branch with no commits yet (e.g. when you first have run cargo init) though that will include the string uncommitted to indicate that once commits are made the information will be of more use.

Fields§

§commit: CommitKind<'a>§modifications: &'a [GitModification<'a>]§branch_name: Option<&'a str>

Trait Implementations§

source§

impl<'a> Debug for GitTestament<'a>

source§

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

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

impl<'a> Display for GitTestament<'a>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for GitTestament<'a>

§

impl<'a> Send for GitTestament<'a>

§

impl<'a> Sync for GitTestament<'a>

§

impl<'a> Unpin for GitTestament<'a>

§

impl<'a> UnwindSafe for GitTestament<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

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

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

§

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 Twhere U: TryFrom<T>,

§

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.