How to convert Box in generics to Box.
from Container<Box<Dog>>
to Container<Box<dyn Animal>>
//example
fn main() {
let container: Container<Box<Dog>> = Container(Box::new(Dog()));
let test: Container<Box<dyn Animal>> = container;
// expected struct `RcHash<Box<dyn Enity>>`
// found struct `RcHash<Box<Role>>`
let test = container as Container<Box<dyn Animal>>;
// non-primitive cast: `Container<Box<Dog>>` as `Container<Box<dyn Animal>>`
// an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
}
//struct
struct Container<T> (T);
struct Dog ();
//trait
trait Animal { fn echo(&self); }
impl Animal for Dog { fn echo(&self) { println!("dog"); } }