mit_commit/
fragment.rs

1use crate::{Body, Comment};
2
3/// A `Fragment` from the [`CommitMessage`], either a comment or body
4#[derive(Clone, Debug, PartialEq, Eq)]
5pub enum Fragment<'a> {
6    /// A fragment that is going to appear in the git log
7    Body(Body<'a>),
8    /// A fragment that is a comment
9    Comment(Comment<'a>),
10}
11
12impl<'a> From<Body<'a>> for Fragment<'a> {
13    fn from(body: Body<'a>) -> Self {
14        Self::Body(body)
15    }
16}
17
18impl<'a> From<Comment<'a>> for Fragment<'a> {
19    fn from(comment: Comment<'a>) -> Self {
20        Self::Comment(comment)
21    }
22}