conventional 0.5.0

A parser library for the Conventional Commit specification.
docs.rs failed to build conventional-0.5.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: conventional-0.4.1

A parser library for the Conventional Commit specification.

Example

use indoc::indoc;
use conventional::{Commit, Error, Simple as _};
use std::str::FromStr;

fn main() -> Result<(), Error> {
let message = indoc!("
docs(example)!: add tested usage example

This example is tested using Rust's doctest capabilities. Having this
example helps people understand how to use the parser.

BREAKING CHANGE: Going from nothing to something, meaning anyone doing
nothing before suddenly has something to do. That sounds like a change
in your break.

Co-Authored-By: Lisa Simpson <lisa@simpsons.fam>
Closes #12
");

let commit = Commit::new(message)?;

// You can access all components of the header.
assert_eq!(commit.type_(), "docs");
assert_eq!(commit.scope(), Some("example"));
assert_eq!(commit.description(), "add tested usage example");

// And the free-form commit body.
assert!(commit.body().unwrap().contains("helps people understand"));

// If a commit is marked with a bang (`!`) OR has a footer with the key
// "BREAKING CHANGE", it is considered a "breaking" commit.
assert!(commit.breaking());

// You can access each footer individually.
assert!(commit.footers().get(0).unwrap().value().contains("That sounds like a change"));

// Footers provide access to their token and value.
assert_eq!(commit.footers().get(1).unwrap().token(), "Co-Authored-By");
assert_eq!(commit.footers().get(1).unwrap().value(), "Lisa Simpson <lisa@simpsons.fam>");

// Two types of separators are supported, regular ": ", and " #":
assert_eq!(commit.footers().get(2).unwrap().separator(), " #");
assert_eq!(commit.footers().get(2).unwrap().value(), "12");
# Ok(())
}