struct Foo;
#[derive(Clone)]
struct Bar {
f: Foo,
}
fn main() {}
This results in
error[E0277]: the trait bound `Foo: std::clone::Clone` is not satisfied
--> <anon>:5:5
|
5 | f: Foo,
| ^^^^^^ the trait `std::clone::Clone` is not implemented for `Foo`
|
= note: required by `std::clone::Clone::clone`
It is only possible to derive Clone
if all the types of the fields implement clone. I would like to do the same thing.
Field
does not seem to expose which traits it implements. How would I check if a Type
implements a specific trait? Is this currently not possible?