With traits that are meant to be used as trait bounds, it can often be nice to add blanket impls for &T, &mut T, Rc<T>, Arc<T>, Box<T>.
This is an example from the futures library. They seem to use a number of things like macros to make this more convenient, as well as Pin impls that use Deref.
I was wondering if there are any gotcha's from just using this instead of spelling out all of the wrapper types:
pub trait Assoc
{
fn assoc( &self );
}
impl<A, T> Assoc for T
where
A: Assoc,
T: std::ops::Deref<Target=A>
{
fn assoc( &self ) { (**self).assoc() }
}
The same question goes for DerefMut.