8
8
#![ cfg_attr( docsrs, feature( doc_cfg, doc_auto_cfg) ) ]
9
9
#![ deny( missing_docs, rust_2018_idioms, unsafe_code) ]
10
10
11
- use byteyarn:: { Yarn , YarnRef } ;
12
11
pub use gix_glob as glob;
12
+ use kstring:: { KString , KStringRef } ;
13
13
14
14
mod assignment;
15
15
///
@@ -34,13 +34,15 @@ pub fn parse(bytes: &[u8]) -> parse::Lines<'_> {
34
34
///
35
35
/// Note that this doesn't contain the name.
36
36
#[ derive( PartialEq , Eq , Debug , Hash , Ord , PartialOrd , Clone , Copy ) ]
37
+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
37
38
pub enum StateRef < ' a > {
38
39
/// The attribute is listed, or has the special value 'true'
39
40
Set ,
40
41
/// The attribute has the special value 'false', or was prefixed with a `-` sign.
41
42
Unset ,
42
43
/// The attribute is set to the given value, which followed the `=` sign.
43
44
/// Note that values can be empty.
45
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
44
46
Value ( state:: ValueRef < ' a > ) ,
45
47
/// The attribute isn't mentioned with a given path or is explicitly set to `Unspecified` using the `!` sign.
46
48
Unspecified ,
@@ -50,6 +52,7 @@ pub enum StateRef<'a> {
50
52
///
51
53
/// Note that this doesn't contain the name.
52
54
#[ derive( PartialEq , Eq , Debug , Hash , Ord , PartialOrd , Clone ) ]
55
+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
53
56
pub enum State {
54
57
/// The attribute is listed, or has the special value 'true'
55
58
Set ,
@@ -64,14 +67,16 @@ pub enum State {
64
67
65
68
/// Represents a validated attribute name
66
69
#[ derive( PartialEq , Eq , Debug , Hash , Ord , PartialOrd , Clone ) ]
67
- pub struct Name ( pub ( crate ) Yarn ) ;
70
+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
71
+ pub struct Name ( pub ( crate ) KString ) ;
68
72
69
73
/// Holds a validated attribute name as a reference
70
74
#[ derive( Copy , Clone , PartialEq , Eq , Debug , Hash , Ord , PartialOrd ) ]
71
- pub struct NameRef < ' a > ( YarnRef < ' a , str > ) ;
75
+ pub struct NameRef < ' a > ( KStringRef < ' a > ) ;
72
76
73
77
/// Name an attribute and describe it's assigned state.
74
78
#[ derive( PartialEq , Eq , Debug , Hash , Ord , PartialOrd , Clone ) ]
79
+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
75
80
pub struct Assignment {
76
81
/// The validated name of the attribute.
77
82
pub name : Name ,
0 commit comments