pub enum Fragment<'a> {
Body(Body<'a>),
Comment(Comment<'a>),
}
Expand description
A Fragment
from the [CommitMessage
], either a comment or body
Variants§
Body(Body<'a>)
A fragment that is going to appear in the git log
Comment(Comment<'a>)
A fragment that is a comment
Trait Implementations§
Source§impl<'a> From<Body<'a>> for Fragment<'a>
impl<'a> From<Body<'a>> for Fragment<'a>
Source§fn from(body: Body<'a>) -> Self
fn from(body: Body<'a>) -> Self
Create a Fragment from a Body
§Arguments
body
- The body to convert into a fragment
§Returns
A new Fragment::Body
variant containing the provided body
§Examples
use mit_commit::{Body, Fragment};
let body = Body::from("Example body");
let fragment = Fragment::from(body.clone());
assert_eq!(fragment, Fragment::Body(body));
Source§impl<'a> From<Comment<'a>> for Fragment<'a>
impl<'a> From<Comment<'a>> for Fragment<'a>
Source§fn from(comment: Comment<'a>) -> Self
fn from(comment: Comment<'a>) -> Self
Create a Fragment from a Comment
§Arguments
comment
- The comment to convert into a fragment
§Returns
A new Fragment::Comment
variant containing the provided comment
§Examples
use mit_commit::{Comment, Fragment};
let comment = Comment::from("# Example comment");
let fragment = Fragment::from(comment.clone());
assert_eq!(fragment, Fragment::Comment(comment));
impl<'a> Eq for Fragment<'a>
impl<'a> StructuralPartialEq for Fragment<'a>
Auto Trait Implementations§
impl<'a> Freeze for Fragment<'a>
impl<'a> RefUnwindSafe for Fragment<'a>
impl<'a> Send for Fragment<'a>
impl<'a> Sync for Fragment<'a>
impl<'a> Unpin for Fragment<'a>
impl<'a> UnwindSafe for Fragment<'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