[][src]Struct mit_commit::Trailer

pub struct Trailer { /* fields omitted */ }

A Trailer you might see a in a CommitMessage, for example 'Co-authored-by: Billie Thompson billie@example.com'

Implementations

impl Trailer[src]

#[must_use]pub fn new(key: &str, value: &str) -> Trailer[src]

Create a new Trailer

This creates a new element that represents the sort of Trailers you get at the end of commits

For example there's Co-authored-by, Relates-to, and Signed-off-by

Example

use mit_commit::{Body, Trailer};
use std::convert::TryFrom;
assert_eq!(
    Trailer::new("Co-authored-by", "#124"),
    Trailer::try_from(Body::from("Co-authored-by: #124"))
        .expect("There should have been a trailer in that body component")
)

#[must_use]pub fn get_key(&self) -> String[src]

Get the key of the Trailer

Example

use mit_commit::{Body, Trailer};
use std::convert::TryFrom;
assert_eq!(
    Trailer::new("Co-authored-by", "#124").get_key(),
    "Co-authored-by"
)

#[must_use]pub fn get_value(&self) -> String[src]

Get the value of the Trailer

Example

use mit_commit::{Body, Trailer};
use std::convert::TryFrom;
assert_eq!(Trailer::new("Co-authored-by", "#124").get_value(), "#124")

Trait Implementations

impl Clone for Trailer[src]

impl Debug for Trailer[src]

impl Eq for Trailer[src]

impl From<Trailer> for String[src]

impl From<Trailer> for Fragment[src]

impl Hash for Trailer[src]

impl Ord for Trailer[src]

impl PartialEq<Trailer> for Trailer[src]

impl PartialOrd<Trailer> for Trailer[src]

impl StructuralEq for Trailer[src]

impl StructuralPartialEq for Trailer[src]

impl TryFrom<Body> for Trailer[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Trailer

impl Send for Trailer

impl Sync for Trailer

impl Unpin for Trailer

impl UnwindSafe for Trailer

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.