How to use Traits as Generic type parameters?

Thanks! I wish the compiler would tell me this. I had Option<Box<Foo>>, everything done as in Rust By Example. Then I did option_with_struct_that_implements_foo.map(Box::new), but the compiler was saying that:

expected trait object dyn Foo, found struct StructThatImplementsFoo

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.