File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -367,7 +367,7 @@ impl<'de> Deserializer<'de> for BoltTypeDeserializer<'de> {
367
367
BoltType :: DateTimeZoneId ( dtz) if name == "Timezone" => {
368
368
visitor. visit_newtype_struct ( BorrowedStrDeserializer :: new ( dtz. tz_id ( ) ) )
369
369
}
370
- _ => self . unexpected ( visitor ) ,
370
+ _ => visitor . visit_newtype_struct ( self ) ,
371
371
}
372
372
}
373
373
@@ -2169,4 +2169,25 @@ mod tests {
2169
2169
2170
2170
assert_eq ! ( actual, Frobnicate :: Foo ) ;
2171
2171
}
2172
+
2173
+ #[ test]
2174
+ fn deserialize_tuple_struct ( ) {
2175
+ #[ derive( Deserialize , Debug ) ]
2176
+ pub struct MyString ( String ) ;
2177
+
2178
+ #[ derive( Deserialize , Debug ) ]
2179
+ pub struct MyThing {
2180
+ my_string : MyString ,
2181
+ }
2182
+
2183
+ let value = BoltType :: from ( "Frobnicate" ) ;
2184
+ let value = [ ( BoltString :: from ( "my_string" ) , value) ]
2185
+ . into_iter ( )
2186
+ . collect :: < BoltMap > ( ) ;
2187
+ let value = BoltType :: Map ( value) ;
2188
+
2189
+ let actual = value. to :: < MyThing > ( ) . unwrap ( ) ;
2190
+
2191
+ assert_eq ! ( actual. my_string. 0 , "Frobnicate" ) ;
2192
+ }
2172
2193
}
You can’t perform that action at this time.
0 commit comments