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>
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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more