Warning
This post was published 33 days ago. The information described in this article may have changed.
I would like to replicate this type in C:
struct IFoo *FooTable[256];
Right now, I have something like this:
struct MyThing<'a> {
foo_table: [Option<Rc<&'a dyn FooTrait>>; 256],
}
However, I'm getting just a ton of errors when attempting to manipulate this field. Too many to list here, which indicates that after years of working with Rust, I still don't understand how to make an entity that can have several pointers to it.
What am I doing wrong? To me the above type makes perfect sense:
I don't understand what else I could possibly need here? Any elucidation would be very helpful, thanks!
EDIT: I forgot to mention that I've also been searching the web for help on this and trying my best to RTFM, but to no avail. Despite there being a ton of sites that cover things like Rc vs Arc, etc, I'm still not able to find a site that clearly illustrates the simple use-case of having a structure with n pointers to it from different places/scopes.
5 posts - 3 participants
🏷️ rust_feed