-
Notifications
You must be signed in to change notification settings - Fork 75
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
feature(stdlib): add snappy codec #543
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.
Hi @MichaHoffmann,
Thank you for your contribution!
This looks good overall. Note that if there are any bugs with this function, they will likely not be prioritized over other work.
A few things before we merge:
- Please add a CHANGELOG.md entry
- Please make a new PR here to document these two new fucntions.
3bc8a6a
to
779ff2f
Compare
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.
- Please run
dd-rust-license-tool write
- Ensure
./scripts/checks.sh
passes - Please make a new PR here to document these two new fucntions.
779ff2f
to
d030c29
Compare
Oh damn, i dont think i can get "wasm32-unknown-unknown" to work; i repaired the other checks though. Do you have an idea what to do about wasm? |
You can use |
Ah! I see there is precedent for it with other functions. Thats awesome, ill fix it tomorrow, thank you! |
Had we considered using https://github.com/BurntSushi/rust-snappy instead? That seems to be a native Rust implementation and so may be easier to get working under WASM. In general, we try to avoid having functions that cannot be run in the playground (WASM) since it introduces some confusion / friction. Some are unavoidable, but this one seems like there may be an option that allows for it. |
Indeed, https://crates.io/crates/snap is more mature. https://crates.io/crates/snappy looks abandoned. |
* add 'encode_snappy' and 'decode_snappy' Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>
d030c29
to
23b769f
Compare
Converted to snap! Thanks for pointing it out! |
decode_snappy => DecodeSnappy; | ||
|
||
right_snappy { | ||
args: func_args![value: value!(decode_base64("LKxUaGUgcXVpY2sgYnJvd24gZm94IGp1bXBzIG92ZXIgMTMgbGF6eSBkb2dzLg==").as_bytes())], |
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.
Do we need to go through base64?
For example see tests here.
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.
I dont know if its needed, but having it in decode and encode shows the duality nicely.
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.
Looks good
I have to deal with snappy encoded messages and this function would help me a lot!