-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
add feature to interop with bytes
crate, add encode_buf
and decode_buf
?
#322
Comments
Thank you for your issue! However we already do support Bytes, we just have it aliased as |
Hi XAMPPRocky, thanks for your quick reply! I am not sure if maybe there's a misunderstanding: It seems you're using the OctetString as an alias for |
I have a working branch which introduces new lifetime type for From performance wise, it would also make sense to introduce |
Interesting, do you know why |
This might a bit unfair comparision since Vec might be as fast as it gets, if you don't need some features of There are actually few cases where I haven't tested yet where that splitting could be valuable and maybe the performance difference is not that clear. In general, there are many cases where you need to store the encoded values in separate buffer before you can calculate the length, and splitting can be useful if it saves some allocations or moving/cloning. But even if it would be possible to use Of course |
I mean, I think the last option is not really what I was after, the goal was to reduce allocations for sure :) I use Bytes a lot for receiving data from the network and then working with it, to avoid allocations (I had some trouble with memory fragmentation in a different project, so kind of defaulting to it). But even providing a Vec which can be re-used would be helpful for that. Thanks for educating me on the intricacies of different encodings, I am pretty new to ASN.1. |
Just a note, OER has now |
I guess a lot of people are working with the bytes crate when using tokio and network protocols. It would be nice if rasn could work directly with the relevant types, with an API similar to https://docs.rs/tokio/latest/tokio/io/trait.AsyncReadExt.html#method.read_buf (so instead of
encode
you'd callencode_buf
), to allow re-using buffers.The text was updated successfully, but these errors were encountered: