11//! Borrowed versions of changelog types.
22//!
33//! These types also contain location information, used by the [`Linter`](crate::linter::Linter).
4+ #[ cfg( feature = "serde" ) ]
45use serde:: Serialize ;
56
67use crate :: span:: { Locator , Span , Spanned } ;
@@ -10,7 +11,8 @@ use super::{owned, traits};
1011
1112type SpannedStr < ' a > = Spanned < & ' a str > ;
1213
13- #[ derive( Debug , Default , PartialEq , Serialize ) ]
14+ #[ derive( Debug , Default , PartialEq ) ]
15+ #[ cfg_attr( feature = "serde" , derive( Serialize ) ) ]
1416pub struct ParsedChangelog < ' a > {
1517 pub ( crate ) source : & ' a str ,
1618 pub ( crate ) title : Option < SpannedStr < ' a > > ,
@@ -19,14 +21,16 @@ pub struct ParsedChangelog<'a> {
1921 pub ( crate ) invalid_spans : Vec < InvalidSpan > ,
2022}
2123
22- #[ derive( Debug , Default , PartialEq , Serialize ) ]
24+ #[ derive( Debug , Default , PartialEq ) ]
25+ #[ cfg_attr( feature = "serde" , derive( Serialize ) ) ]
2326pub struct ParsedUnreleased < ' a > {
2427 pub ( crate ) heading_span : Span ,
2528 pub ( crate ) url : Option < String > ,
2629 pub ( crate ) changes : Vec < ParsedChanges < ' a > > ,
2730}
2831
29- #[ derive( Debug , Default , PartialEq , Serialize ) ]
32+ #[ derive( Debug , Default , PartialEq ) ]
33+ #[ cfg_attr( feature = "serde" , derive( Serialize ) ) ]
3034pub struct ParsedRelease < ' a > {
3135 pub ( crate ) heading_span : Span ,
3236 pub ( crate ) version : SpannedStr < ' a > ,
@@ -36,14 +40,16 @@ pub struct ParsedRelease<'a> {
3640 pub ( crate ) changes : Vec < ParsedChanges < ' a > > ,
3741}
3842
39- #[ derive( Debug , Default , PartialEq , Serialize ) ]
43+ #[ derive( Debug , Default , PartialEq ) ]
44+ #[ cfg_attr( feature = "serde" , derive( Serialize ) ) ]
4045pub struct ParsedChanges < ' a > {
4146 pub ( crate ) heading_span : Span ,
4247 pub ( crate ) kind : SpannedStr < ' a > ,
4348 pub ( crate ) items : Vec < SpannedStr < ' a > > ,
4449}
4550
46- #[ derive( Debug , PartialEq , Serialize ) ]
51+ #[ derive( Debug , PartialEq ) ]
52+ #[ cfg_attr( feature = "serde" , derive( Serialize ) ) ]
4753pub enum InvalidSpan {
4854 InvalidTitle ( Span ) ,
4955 InvalidSectionHeading ( Span ) ,
0 commit comments