Struct mit_commit::Trailer
source · pub struct Trailer<'a> { /* private fields */ }
Expand description
A Trailer
you might see a in a [CommitMessage
], for example
‘Co-authored-by: Billie Thompson billie@example.com’
Implementations§
source§impl<'a> Trailer<'a>
impl<'a> Trailer<'a>
sourcepub const fn new(key: Cow<'a, str>, value: Cow<'a, str>) -> Trailer<'a>
pub const fn new(key: Cow<'a, str>, value: Cow<'a, str>) -> Trailer<'a>
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 std::convert::TryFrom;
use mit_commit::{Body, Trailer};
assert_eq!(
Trailer::new("Co-authored-by".into(), "#124".into()),
Trailer::try_from(Body::from("Co-authored-by: #124"))
.expect("There should have been a trailer in that body component")
)
Trait Implementations§
source§impl<'a> Ord for Trailer<'a>
impl<'a> Ord for Trailer<'a>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<'a> PartialEq<Trailer<'a>> for Trailer<'a>
impl<'a> PartialEq<Trailer<'a>> for Trailer<'a>
source§impl<'a> PartialOrd<Trailer<'a>> for Trailer<'a>
impl<'a> PartialOrd<Trailer<'a>> for Trailer<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<'a> Eq for Trailer<'a>
impl<'a> StructuralEq for Trailer<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Trailer<'a>
impl<'a> Send for Trailer<'a>
impl<'a> Sync for Trailer<'a>
impl<'a> Unpin for Trailer<'a>
impl<'a> UnwindSafe for Trailer<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more