File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -1510,6 +1510,41 @@ where
15101510
15111511////////////////////////////////////////////////////////////////////////////////
15121512
1513+ /// A deserializer holding an `EnumAccess`.
1514+ #[ derive( Clone , Debug ) ]
1515+ pub struct EnumAccessDeserializer < A > {
1516+ access : A ,
1517+ }
1518+
1519+ impl < A > EnumAccessDeserializer < A > {
1520+ /// Construct a new `EnumAccessDeserializer<A>`.
1521+ pub fn new ( access : A ) -> Self {
1522+ EnumAccessDeserializer { access : access }
1523+ }
1524+ }
1525+
1526+ impl < ' de , A > de:: Deserializer < ' de > for EnumAccessDeserializer < A >
1527+ where
1528+ A : de:: EnumAccess < ' de > ,
1529+ {
1530+ type Error = A :: Error ;
1531+
1532+ fn deserialize_any < V > ( self , visitor : V ) -> Result < V :: Value , Self :: Error >
1533+ where
1534+ V : de:: Visitor < ' de > ,
1535+ {
1536+ visitor. visit_enum ( self . access )
1537+ }
1538+
1539+ forward_to_deserialize_any ! {
1540+ bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string
1541+ bytes byte_buf option unit unit_struct newtype_struct seq tuple
1542+ tuple_struct map struct enum identifier ignored_any
1543+ }
1544+ }
1545+
1546+ ////////////////////////////////////////////////////////////////////////////////
1547+
15131548mod private {
15141549 use lib:: * ;
15151550
You can’t perform that action at this time.
0 commit comments