-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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(serde_v8): support BigInt serialization #18225
Conversation
This commit enables serializing `v8::BigInt` to `num_bigint::BigInt` in Rust.
b5a259a
to
7951026
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.
LGTM.
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.
Why not use i64
?
serde_v8/magic/bigint.rs
Outdated
let v8bigint = v8::Local::<v8::BigInt>::try_from(value) | ||
.map_err(|_| Error::ExpectedBigInt)?; | ||
let word_count = v8bigint.word_count(); | ||
let mut words = vec![0; word_count]; |
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.
nit: use SmallVec
@littledivy because we already support i64, and i64 is limited to fixed width 8 byte integers, and this specific thing is encoding a variable size integer. This could be a |
This commit enables serializing `v8::BigInt` to `num_bigint::BigInt` in Rust. Pre-requisite for sub upcoming feature work.
This commit enables serializing
v8::BigInt
tonum_bigint::BigInt
in Rust.
Pre-requisite for sub upcoming feature work.