I'm struggling with an error when I combine Trait objects with Trait bounds. Here's an example:
When I try to use a Box<dyn Foo> as a type parameter with bound Foo, I get:
the trait `Foo` is not implemented for `std::boxed::Box<dyn Foo>`
I feel caught in a Catch-22 here: I can't simply pass around a dyn Foo and apparently I can't use a Box<dyn Foo> in its place. Switching to references would make the lifetime management very complex. I've proposed a workaround, but it really doesn't seem like the right option.
Is there a more idiomatic way to deal with this? Or is the answer to simply not combine static and dynamic dispatch like this?