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
sourceimpl<'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
sourceimpl<'a> Ord for Trailer<'a>
impl<'a> Ord for Trailer<'a>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<'a> PartialEq<Trailer<'a>> for Trailer<'a>
impl<'a> PartialEq<Trailer<'a>> for Trailer<'a>
sourceimpl<'a> PartialOrd<Trailer<'a>> for Trailer<'a>
impl<'a> PartialOrd<Trailer<'a>> for Trailer<'a>
sourcefn partial_cmp(&self, other: &Trailer<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &Trailer<'a>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
impl<'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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more