[][src]Struct git_testament::GitTestament

pub struct GitTestament<'a> {
    pub commit: CommitKind<'a>,
    pub modifications: &'a [GitModification<'a>],
}

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>]

Trait Implementations

impl<'a> Display for GitTestament<'a>[src]

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

Auto Trait Implementations

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

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

Blanket Implementations

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.