We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently it's not possible to construct a Value from neither i64 nor u64 but only from f64 which is a bit of a limitation.
Value
i64
u64
f64
For example, the code below will fail:
assert_eq!( json!(1), Value::Number(Number::from_f64(1)), )
because of 1_u64 and 1_f64 mismatch. There is no other way to construct number either, only from f64.
1_u64
1_f64
Add Number::from_i64 and Number::from_u64 to make it possible to construct Value::Number from these scalar types.
Number::from_i64
Number::from_u64
Value::Number
I would love to hear @dtolnay thoughts on the proposed addition :)
Thanks! Oleg
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The use case
Currently it's not possible to construct a
Value
from neitheri64
noru64
but only fromf64
which is a bit of a limitation.For example, the code below will fail:
because of
1_u64
and1_f64
mismatch. There is no other way to construct number either, only fromf64
.Proposal
Add
Number::from_i64
andNumber::from_u64
to make it possible to constructValue::Number
from these scalar types.I would love to hear @dtolnay thoughts on the proposed addition :)
Thanks!
Oleg
The text was updated successfully, but these errors were encountered: