mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-25 19:47:55 +00:00
Add associated type test
This commit is contained in:
@@ -539,6 +539,22 @@ fn test_gen() {
|
|||||||
array: [u8; 256],
|
array: [u8; 256],
|
||||||
}
|
}
|
||||||
assert_ser::<BigArray>();
|
assert_ser::<BigArray>();
|
||||||
|
|
||||||
|
trait AssocSerde {
|
||||||
|
type Assoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct NoSerdeImpl;
|
||||||
|
impl AssocSerde for NoSerdeImpl {
|
||||||
|
type Assoc = u32;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
struct AssocDerive<T: AssocSerde> {
|
||||||
|
assoc: T::Assoc
|
||||||
|
}
|
||||||
|
|
||||||
|
assert::<AssocDerive<NoSerdeImpl>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user