3 ms·
You can do that if you change it to &Any and then downcast. See the docs for examples. If the issue is that you have to downcast, then your initial claim that R
by foldr 8y ago
You can do that if you change it to &Any and then downcast. See the docs for examples. If the issue is that you have to downcast, then your initial claim that Rust lacks void pointers was irrelevant even if true, since you also have to downcast a void pointer in C before you can perform operations on the type that it's actually pointing to.
- EugeneOZ 8y ago> If the issue is that you have to downcast It's the difference between dynamic language and language with synthetic type for reflections.
- xfer 8y agoYou can't downcast it to anything you want, it returns an Option, void pointers in C are not certainly the same, it's unsafe.
- foldr 8y agoI know. That's why I said it's "a safe analogue of casting a void pointer to another type".