File tree 1 file changed +35
-0
lines changed 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -1510,6 +1510,41 @@ where
1510
1510
1511
1511
////////////////////////////////////////////////////////////////////////////////
1512
1512
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
+
1513
1548
mod private {
1514
1549
use lib:: * ;
1515
1550
You can’t perform that action at this time.
0 commit comments