Expand description
Collection of derive macros with explicitable bounds
They derive the matching trait but have an optional bounded_to attribute to override the
bounds.
use derive_bounded::Clone;
trait Trait {
type B: Clone;
}
#[derive(Clone)]
#[bounded_to(T::B)]
struct A<T: Trait> {
f: T::B,
}
#[derive(Clone)]
#[bounded_to(T::B)]
struct B<T: Trait> {
f: A<T>,
}The auto-generated impl for Clone will have a where clause with T::B: Clone instead of T: Clone.
As this version there are few known limitations:
- The macro does not auto-generate the where clause for associated traits, e.g.
Ain the example needs thebounded_toattribute
Later versions will address those.