Struct mit_commit::Trailers [−][src]
pub struct Trailers { /* fields omitted */ }
Expand description
A Collection of Trailer
Implementations
Iterate over the trailers
Examples
use mit_commit::{Trailer, Trailers};
let trailers = Trailers::from(vec![
Trailer::new("Co-authored-by", "Billie Thompson <billie@example.com>"),
Trailer::new("Co-authored-by", "Someone Else <someone@example.com>"),
Trailer::new("Relates-to", "#124"),
]);
let mut iterator = trailers.iter();
assert_eq!(
iterator.next(),
Some(&Trailer::new(
"Co-authored-by",
"Billie Thompson <billie@example.com>"
))
);
assert_eq!(
iterator.next(),
Some(&Trailer::new(
"Co-authored-by",
"Someone Else <someone@example.com>"
))
);
assert_eq!(iterator.next(), Some(&Trailer::new("Relates-to", "#124")));
assert_eq!(iterator.next(), None);
How many trailers are there
Examples
use mit_commit::{Trailer, Trailers};
let trailers = Trailers::from(vec![
Trailer::new("Co-authored-by", "Billie Thompson <billie@example.com>"),
Trailer::new("Co-authored-by", "Someone Else <someone@example.com>"),
]);
assert_eq!(trailers.len(), 2)
Are there no trailers
Examples
use mit_commit::{Trailer, Trailers};
assert_eq!(
Trailers::from(vec![
Trailer::new("Co-authored-by", "Billie Thompson <billie@example.com>"),
Trailer::new("Co-authored-by", "Someone Else <someone@example.com>"),
])
.is_empty(),
false
);
let trailers: Vec<Trailer> = Vec::new();
assert_eq!(Trailers::from(trailers).is_empty(), true)
Trait Implementations
Iterate over the trailers
Examples
use mit_commit::{Trailer, Trailers};
let trailers = Trailers::from(vec![
Trailer::new("Co-authored-by", "Billie Thompson <billie@example.com>"),
Trailer::new("Co-authored-by", "Someone Else <someone@example.com>"),
Trailer::new("Relates-to", "#124"),
]);
let mut iterator = trailers.into_iter();
assert_eq!(
iterator.next(),
Some(Trailer::new(
"Co-authored-by",
"Billie Thompson <billie@example.com>"
))
);
assert_eq!(
iterator.next(),
Some(Trailer::new(
"Co-authored-by",
"Someone Else <someone@example.com>"
))
);
assert_eq!(iterator.next(), Some(Trailer::new("Relates-to", "#124")));
assert_eq!(iterator.next(), None);
Auto Trait Implementations
impl RefUnwindSafe for Trailers
impl UnwindSafe for Trailers
Blanket Implementations
Mutably borrows from an owned value. Read more