Struct git_conventional::Commit
source · pub struct Commit<'a> { /* private fields */ }
Expand description
A conventional commit.
Implementations§
source§impl<'a> Commit<'a>
impl<'a> Commit<'a>
sourcepub fn parse(string: &'a str) -> Result<Self, Error>
pub fn parse(string: &'a str) -> Result<Self, Error>
Create a new Conventional Commit based on the provided commit message string.
§Errors
This function returns an error if the commit does not conform to the Conventional Commit specification.
sourcepub fn description(&self) -> &'a str
pub fn description(&self) -> &'a str
The commit description.
sourcepub fn body(&self) -> Option<&'a str>
pub fn body(&self) -> Option<&'a str>
The commit body, containing a more detailed explanation of the commit changes.
sourcepub fn breaking(&self) -> bool
pub fn breaking(&self) -> bool
A flag to signal that the commit contains breaking changes.
This flag is set either when the commit has an exclamation mark after the message type and scope, e.g.:
feat(scope)!: this is a breaking change
Or when the BREAKING CHANGE:
footer is defined:
feat: my commit description
BREAKING CHANGE: this is a breaking change
sourcepub fn breaking_description(&self) -> Option<&'a str>
pub fn breaking_description(&self) -> Option<&'a str>
Explanation for the breaking change.
Note: if no BREAKING CHANGE
footer is provided, the description
is expected to describe
the breaking change.
Any footer.
A footer is similar to a Git trailer, with the exception of not requiring whitespace before newlines.