I have an
Animal trait containing a
make_noise function, and a
Cow both implementing that trait.
I now want to make a
Farm that “owns” these two animals (
Vec<Animal>). The farm has a
good_morning method that calls
make_noise for all owned animals:
I get several errors:
the trait bound Animal + 'static: std::marker::Sized is not satisfied
the trait Animal cannot be made into an object
I tried using
Vec<&Animal> and adding lifetime specifiers, but I still get the same error:
I’m not sure how to implement the Sized trait, and if that would be relevant here.