File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ impl<'de> serde::de::Deserialize<'de> for Val {
25
25
. i64 ( |value| Ok ( Self :: Integer ( value) ) )
26
26
. f64 ( |value| Ok ( Self :: Float ( value) ) )
27
27
. string ( |value| Ok ( Val :: String ( value. to_owned ( ) ) ) )
28
- . none ( || Ok ( Self :: Null ) )
28
+ . unit ( || Ok ( Self :: Null ) )
29
29
. seq ( |value| value. deserialize ( ) . map ( Val :: Array ) )
30
30
. map ( |value| value. deserialize ( ) . map ( Val :: Object ) )
31
31
. deserialize ( d)
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ fn test_file() {
16
16
place : Place ,
17
17
#[ serde( rename = "arr" ) ]
18
18
elements : Vec < String > ,
19
+ nullable : Option < String > ,
19
20
}
20
21
21
22
#[ derive( Debug , Deserialize ) ]
@@ -54,6 +55,7 @@ fn test_file() {
54
55
},
55
56
FOO: "FOO should be overridden",
56
57
bar: "I am bar",
58
+ nullable: null
57
59
}
58
60
"# ,
59
61
FileFormat :: Json5 ,
@@ -93,6 +95,7 @@ fn test_file() {
93
95
"John Smith" . to_owned( )
94
96
) ;
95
97
}
98
+ assert_eq ! ( s. nullable, None ) ;
96
99
}
97
100
98
101
#[ test]
You can’t perform that action at this time.
0 commit comments