@@ -4,7 +4,7 @@ use crate::parse::Error;
4
4
use bitflags:: bitflags;
5
5
use juniper:: GraphQLObject ;
6
6
7
- #[ derive( Debug , PartialEq , Eq ) ]
7
+ #[ derive( Debug , PartialEq , Eq , Clone , Copy ) ]
8
8
pub struct AllergenInfo ( AllergenFlags ) ;
9
9
10
10
impl AllergenInfo {
@@ -78,22 +78,14 @@ impl Display for AllergenInfo {
78
78
}
79
79
}
80
80
81
- impl Deref for AllergenInfo {
82
- type Target = AllergenFlags ;
83
-
84
- fn deref ( & self ) -> & Self :: Target {
85
- & self . 0
86
- }
87
- }
88
-
89
- impl Into < Vec < & ' static str > > for & AllergenInfo {
90
- fn into ( self ) -> Vec < & ' static str > {
91
- ( & self . 0 ) . into ( )
81
+ impl From < AllergenFlags > for AllergenInfo {
82
+ fn from ( flags : AllergenFlags ) -> Self {
83
+ Self ( flags)
92
84
}
93
85
}
94
86
95
87
bitflags ! {
96
- #[ derive( Debug , PartialEq , Eq ) ]
88
+ #[ derive( Debug , PartialEq , Eq , Clone , Copy ) ]
97
89
pub struct AllergenFlags : u16 {
98
90
const Egg = 1 ;
99
91
const Fish = 1 << 1 ;
@@ -147,6 +139,12 @@ impl Into<Vec<&'static str>> for &AllergenFlags {
147
139
}
148
140
}
149
141
142
+ impl Into < Vec < & ' static str > > for AllergenFlags {
143
+ fn into ( self ) -> Vec < & ' static str > {
144
+ ( & self ) . into ( )
145
+ }
146
+ }
147
+
150
148
impl Display for AllergenFlags {
151
149
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
152
150
let allergens: Vec < & str > = self . into ( ) ;
0 commit comments