-
Notifications
You must be signed in to change notification settings - Fork 304
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
SATS: add support needed for BFLATN => BSATN directly #750
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment-related suggestions. Code looks good.
crates/sats/src/bsatn/ser.rs
Outdated
unsafe fn serialize_bsatn(self, _: &crate::AlgebraicType, bsatn: &[u8]) -> Result<Self::Ok, Self::Error> { | ||
self.writer.put_slice(bsatn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a meaningful debug_assert!
you could add here that the bsatn
is compatible with the (currently ignored) AlgebraicType
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, you could do basically what the safety requirement of calling this method is.
It is a bit expensive, possibly even for debug mode, but I'll add it for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the other cases, we'd need to make the iterator clonable but I can add that too.
Also some associated refactoring
402146b
to
cf2827c
Compare
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io> Signed-off-by: Mazdak Farrokhzad <twingoow@gmail.com>
Also some associated refactoring
Description of Changes
Extends
spacetimedb_sats::ser::Serializer
to support:Adds
spacetimedb_sats::bsatn::to_len
which computes the length of a bsatn encoding without storing the encoding.API and ABI breaking changes
None
Expected complexity level and risk
2, Some unsafe code, and this extends the
Serializer
trait.