Warning
This post was published 44 days ago. The information described in this article may have changed.
I have a struct similar to this:
struct MyStruct {
things: Vec<Box<dyn MyTrait>>
}
And I'd like to be able to do this:
fn get_all_things(&self) -> &[&dyn MyTrait] {
how?
}
i.e. I'd like to return a slice of references to something that implements the trait rather than &[Box<dyn MyTrait>]
.
Is it possible?
7 posts - 5 participants
🏷️ rust_feed