Skip to content
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

rust: add len method to SbpMessage #1078

Merged
merged 3 commits into from
Oct 1, 2021
Merged

rust: add len method to SbpMessage #1078

merged 3 commits into from
Oct 1, 2021

Conversation

notoriaga
Copy link
Contributor

@notoriaga notoriaga commented Oct 1, 2021

While updating the console realized that it was using the sbp_sizemethod (now called encoded_len). This adds a len method to SbpMessage (WireFormat isn't usable by downstream crates). This function is actually a little different, it adds on the 8 bytes for the header + crc, which sbp_size did not. I think this is probably what we actually want in the console, in order to show how much data the console has read

Copy link
Contributor

@john-michaelburke john-michaelburke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally an explanation for the discrepancy in data rate between new and old console 😄

Copy link
Contributor

@silverjam silverjam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think our nomenclature could use some consideration here. I think usually "encoded len" is used to indicate how big the byte buffer would be if the message was encoded into it's "on wire" representation.

@silverjam
Copy link
Contributor

Actually I think our nomenclature could use some consideration here. I think usually "encoded len" is used to indicate how big the byte buffer would be if the message was encoded into it's "on wire" representation.

See:

So maybe we should switch around len and encoded_len or rename len to wire_len or packed_len

@notoriaga
Copy link
Contributor Author

notoriaga commented Oct 1, 2021

Great idea, did the switcheroo

@notoriaga notoriaga merged commit 7a3d21a into master Oct 1, 2021
@notoriaga notoriaga deleted the steve/rust-release-3 branch October 1, 2021 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants