-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to support repeated structs? #16
Comments
Yeah, there isn't really currently a great way to support NavSat-style repeated messages. I think the way to do it (and I can look into adding the necessary infrastructure, probably this weekend or next) would be to extend the derive macros to have an explicit notion of arrays, and then the field accessor function could take an index, something like this: navsat_packet.num_svs(); // Number of SVs
navsat_packet.svs(5).gnssId(); // Get the gnssId of space vehicle 5 although, you'd want to be able to catch if the user passed an invalid index, so maybe it should look more like: navsat_packet.svs(5).unwrap().gnss_id(); and I imagine a common operation is iterating over the SVs... so maybe it could just return an iterator. Something like: for sv in navsat_packet.svs() {
sv.gnss_id();
} and, of course, you the end user would still be able to select the nth navsat by using the navsat_packet.svs().nth(5).unwrap().gnss_id(); Does that seem like a reasonable API to you? |
This would work 100% for us. |
You might want to take a look over at: They have added vec<> types to the code generator among other things. Not sure if they plan to upstream it. |
Awesome, thanks, I will definitely keep tabs on that. It turns out that implementing |
We are looking at adding the NavSat message, but it there doesn't seem to be a way to support repeated structs. Is there a way to do this or is it just not supported yet?
The text was updated successfully, but these errors were encountered: