use serde_derive::{Deserialize, Serialize}; mod remote { pub struct Struct { pub t: T, pub u: U, } } #[derive(Serialize, Deserialize)] #[serde(remote = "remote::StructGeneric")] struct StructDef { t: u8, u: U, } fn main() {}