Struct mit_commit::Comments
source · pub struct Comments<'a> { /* private fields */ }
Expand description
A collection of comments from a [CommitMessage
]
Implementations§
source§impl<'a> Comments<'a>
impl<'a> Comments<'a>
sourcepub fn iter(&self) -> Iter<'_, Comment<'_>>
pub fn iter(&self) -> Iter<'_, Comment<'_>>
Iterate over the Comment
in the Comments
§Examples
use mit_commit::{Comment, Comments};
let trailers = Comments::from(vec![
Comment::from("# Comment 1"),
Comment::from("# Comment 2"),
Comment::from("# Comment 3"),
]);
let mut iterator = trailers.iter();
assert_eq!(iterator.next(), Some(&Comment::from("# Comment 1")));
assert_eq!(iterator.next(), Some(&Comment::from("# Comment 2")));
assert_eq!(iterator.next(), Some(&Comment::from("# Comment 3")));
assert_eq!(iterator.next(), None);
Trait Implementations§
source§impl<'a> IntoIterator for &'a Comments<'a>
impl<'a> IntoIterator for &'a Comments<'a>
source§fn into_iter(self) -> Self::IntoIter
fn into_iter(self) -> Self::IntoIter
Iterate over the Comment
in the Comments
§Examples
use std::borrow::Borrow;
use mit_commit::{Comment, Comments};
let comments = Comments::from(vec![
Comment::from("# Comment 1"),
Comment::from("# Comment 2"),
Comment::from("# Comment 3"),
]);
let comments_ref = comments.borrow();
let mut iterator = comments_ref.into_iter();
assert_eq!(iterator.next(), Some(&Comment::from("# Comment 1")));
assert_eq!(iterator.next(), Some(&Comment::from("# Comment 2")));
assert_eq!(iterator.next(), Some(&Comment::from("# Comment 3")));
assert_eq!(iterator.next(), None);
source§impl<'a> IntoIterator for Comments<'a>
impl<'a> IntoIterator for Comments<'a>
source§fn into_iter(self) -> Self::IntoIter
fn into_iter(self) -> Self::IntoIter
Iterate over the Comment
in the Comments
§Examples
use mit_commit::{Comment, Comments};
let trailers = Comments::from(vec![
Comment::from("# Comment 1"),
Comment::from("# Comment 2"),
Comment::from("# Comment 3"),
]);
let mut iterator = trailers.into_iter();
assert_eq!(iterator.next(), Some(Comment::from("# Comment 1")));
assert_eq!(iterator.next(), Some(Comment::from("# Comment 2")));
assert_eq!(iterator.next(), Some(Comment::from("# Comment 3")));
assert_eq!(iterator.next(), None);
source§impl<'a> PartialEq for Comments<'a>
impl<'a> PartialEq for Comments<'a>
impl<'a> Eq for Comments<'a>
impl<'a> StructuralPartialEq for Comments<'a>
Auto Trait Implementations§
impl<'a> Freeze for Comments<'a>
impl<'a> RefUnwindSafe for Comments<'a>
impl<'a> Send for Comments<'a>
impl<'a> Sync for Comments<'a>
impl<'a> Unpin for Comments<'a>
impl<'a> UnwindSafe for Comments<'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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)