Why not just add missing implementations? I'm not sure what Value is here, but you can just implement MyTrait for Box<dyn Value>. As for references, if all methods of your trait accept a reference, you can write a blanket implementation that covers all references to types implementing MyTrait:
impl<'a, T: MyTrait> MyTrait for &'a T {
fn foo(&self) {
<T as MyTrait>::foo(self)
}
}
Thank you, @2e71828. Your solution is even simpler and solves both cases.
I only had to change T: MyTrait to T: MyTrait + ?Sized, to make it generic over both Box<dyn Trait> and references.
You have to be careful to call the implementation of the inner type, not the current implementation. For example, for Box<dyn MyTrait> it can be done like this: