Commit 0c1b047 1 parent 6ce6ad6 commit 0c1b047 Copy full SHA for 0c1b047
File tree 1 file changed +27
-2
lines changed
1 file changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -2594,11 +2594,36 @@ fn deserialize_map(
2594
2594
}
2595
2595
Some ( path) => quote ! ( #path) ,
2596
2596
} ;
2597
+
2598
+ let no_variant_expr = if field. attrs . default ( ) . is_none ( ) && cattrs. default ( ) . is_none ( ) {
2599
+ let span = field. original . span ( ) ;
2600
+ quote_spanned ! ( span=>
2601
+ return _serde:: __private:: Err (
2602
+ _serde:: de:: Error :: custom( _e)
2603
+ ) ;
2604
+ )
2605
+ } else {
2606
+ let is_missing = Expr ( expr_is_missing ( field, cattrs) ) ;
2607
+ quote ! ( #is_missing)
2608
+ } ;
2609
+
2597
2610
quote ! {
2598
- let #name: #field_ty = #func(
2611
+ let #name: #field_ty = match #func(
2599
2612
_serde:: __private:: de:: FlatMapDeserializer (
2600
2613
& mut __collect,
2601
- _serde:: __private:: PhantomData ) ) ?;
2614
+ _serde:: __private:: PhantomData ) ) {
2615
+ _serde:: __private:: Ok ( #name) => #name,
2616
+ _serde:: __private:: Err (
2617
+ _e @ _serde:: __private:: de:: FlatMapDeserializerError :: NoVariantFoundInFlattenedData ( ..)
2618
+ ) => {
2619
+ #no_variant_expr
2620
+ }
2621
+ _serde:: __private:: Err (
2622
+ _serde:: __private:: de:: FlatMapDeserializerError :: Inner ( e)
2623
+ ) => {
2624
+ return _serde:: __private:: Err ( e) ;
2625
+ }
2626
+ } ;
2602
2627
}
2603
2628
} ) ;
2604
2629
You can’t perform that action at this time.
0 commit comments