-
Notifications
You must be signed in to change notification settings - Fork 238
feat: rkyv support #990
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
feat: rkyv support #990
Conversation
070c6d4
to
65e074f
Compare
strange cargo doc fails, no issue on my local worktree |
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.
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.
makes sense, please rebase and fix ci
crates/primitives/src/bytes/rkyv.rs
Outdated
fn deserialize(&self, _deserializer: &mut D) -> Result<Bytes, D::Error> { | ||
let mut result = BytesMut::new(); | ||
result.extend_from_slice(self.as_slice()); | ||
Ok(Bytes(result.freeze())) |
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.
Bytes::copy_from_slice
65e074f
to
0ae8139
Compare
Motivation
This change adds support for the rkyv serialization framework for the Uint<BITS, LIMBS> type. rkyv enables zero-copy deserialization, making it ideal for performance-critical applications such as memory-mapped files, shared memory, or inter-process communication (IPC).
ruint has [rkyv] support starts from 1.16.0.
The project already supports other serialization formats like serde and rlp, so supporting rkyv extends compatibility with a high-performance, archive-based serialization format.
Solution
rkyv
feature gate enables optional dependencyrkyv
and featurerkyv
ofruint
.rkyv
feature gated derives macro.rkyv
adds some helper function between archived types and original ones.Thoses codes was previously maintained as a patch used internally in scroll for last year.
PR Checklist