How to write a trait bound for a reference to an associated type on the trait itself?
问题 I have this code: extern crate serde; use serde::de::DeserializeOwned; use serde::Serialize; trait Bar<'a, T: 'a> where T: Serialize, &'a T: DeserializeOwned, { } I would like to write this using an associated type, because the type T is unimportant to the users of this type. I got this far: trait Bar { type T: Serialize; } I cannot figure out how to specify the other bound. Ultimately, I want to use a function like this: extern crate serde_json; fn test<I: Bar>(t: I::T) -> String { serde