mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-22 20:38:02 +00:00
allow Deserialize derive to handle generic unit structs
This commit is contained in:
@@ -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