Closed scturtle closed 1 year ago
Sorry for the confusion, S<T>
is meant to be a type, not a trait. This works:
use core::fmt::Display;
struct S<T>(T);
impl<T> S<T> where T: Copy + Display {
fn foo(&self, x: T) {}
}
fn main() {}
About your question, I've also added a link in that section to Generic Implementations.
The code in
Working with Types
->Types, Traits, Generics
->Generics
->Implementing Families — impl<>
:causing a compilation error:
It seems that a
dyn
should be added. Any more references about this feature?