Commit

Struct Commit 

Source
pub struct Commit<'a> {
    pub body: Option<&'a str>,
    pub desc: &'a str,
    pub footer: Vec<Footer<'a>>,
    pub is_breaking_change: bool,
    pub scope: Option<&'a str>,
    pub ty: &'a str,
}
Expand description

A commit message.

As per the specification, a commit message is made out of a mandatory description, an optional body and 0..n optional footers. The different sections are separated by an empty newline. Footers can be each separated with a newline, however, this is not needed.

§Example

feat(some scope): a short and concise description

This is a longer body message. It can wrapped around
and be put onto multiple lines.

This is still part of the body.

Fixes #123
PR-close #124
Signed-off-by: SirWindfield

Fields§

§body: Option<&'a str>

The optional body.

§desc: &'a str

The mandatory description.

§footer: Vec<Footer<'a>>

A list of footers. Empty when none are part of the commit message.

§is_breaking_change: bool

Set if the commit is a breaking change.

§scope: Option<&'a str>

The optional scope.

§ty: &'a str

The mandatory type.

Types other than feat and fix are optional. For more information, please take a look at the specification, paragraphs 1-3.

Implementations§

Source§

impl<'a> Commit<'a>

Source

pub fn new() -> Commit<'a>

Creates a default commit.

Source

pub fn from( ty: &'a str, scope: Option<&'a str>, desc: &'a str, body: Option<&'a str>, is_breaking_change: bool, footer: Vec<Footer<'a>>, ) -> Commit<'a>

Creates a commit with the given values.

Trait Implementations§

Source§

impl<'a> Clone for Commit<'a>

Source§

fn clone(&self) -> Commit<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Commit<'a>

Source§

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

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

impl<'a> Default for Commit<'a>

Source§

fn default() -> Commit<'a>

Returns the “default value” for a type. Read more
Source§

impl<'a> Hash for Commit<'a>

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> PartialEq for Commit<'a>

Source§

fn eq(&self, other: &Commit<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Eq for Commit<'a>

Source§

impl<'a> StructuralPartialEq for Commit<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Commit<'a>

§

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§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.