Add test of generic remote derive with getter
Currently fails to compile. error[E0107]: missing generics for struct `StructGeneric` --> test_suite/tests/test_remote.rs:181:18 | 181 | #[serde(remote = "remote::StructGeneric")] | ^^^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> test_suite/tests/test_remote.rs:78:16 | 78 | pub struct StructGeneric<T> { | ^^^^^^^^^^^^^ - help: add missing generic argument | 181 | #[serde(remote = StructGeneric<T>)] | ~~~~~~~~~~~~~~~~
This commit is contained in:
parent
fabbd2b097
commit
7328b34810
@ -79,6 +79,12 @@ mod remote {
|
||||
pub value: T,
|
||||
}
|
||||
|
||||
impl<T> StructGeneric<T> {
|
||||
pub fn get_value(&self) -> &T {
|
||||
&self.value
|
||||
}
|
||||
}
|
||||
|
||||
pub enum EnumGeneric<T> {
|
||||
Variant(T),
|
||||
}
|
||||
@ -171,6 +177,13 @@ struct StructPubDef {
|
||||
b: remote::Unit,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(remote = "remote::StructGeneric")]
|
||||
struct StructGenericWithGetterDef<T> {
|
||||
#[serde(getter = "remote::StructGeneric::get_value")]
|
||||
value: T,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(remote = "remote::StructGeneric<u8>")]
|
||||
struct StructConcrete {
|
||||
@ -206,3 +219,9 @@ impl From<StructPrivDef> for remote::StructPriv {
|
||||
remote::StructPriv::new(def.a, def.b)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<StructGenericWithGetterDef<T>> for remote::StructGeneric<T> {
|
||||
fn from(def: StructGenericWithGetterDef<T>) -> Self {
|
||||
remote::StructGeneric { value: def.value }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user