mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-10-25 13:05:08 +00:00
allow Deserialize derive to handle generic unit structs
This commit is contained in:
1 parent
6502838f27
commit
89c8d85de9
2 files changed
+31
-4
No files matched your search
@@ -46,6 +46,9 @@ mod macros;
|
||||
#[derive(Copy, Clone, PartialEq, Debug, Deserialize)]
|
||||
struct UnitStruct;
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Debug, Deserialize)]
|
||||
struct GenericUnitStruct<const N: u8>;
|
||||
|
||||
#[derive(PartialEq, Debug, Deserialize)]
|
||||
struct NewtypeStruct(i32);
|
||||
|
||||
@@ -883,6 +886,17 @@ fn test_unit_struct() {
|
||||
test(UnitStruct, &[Token::UnitStruct { name: "UnitStruct" }]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_generic_unit_struct() {
|
||||
test(GenericUnitStruct::<8>, &[Token::Unit]);
|
||||
test(
|
||||
GenericUnitStruct::<8>,
|
||||
&[Token::UnitStruct {
|
||||
name: "GenericUnitStruct",
|
||||
}],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_newtype_struct() {
|
||||
test(
|
||||
|
||||
Reference in new issue
Block a user