Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

128-bit integer support #110

Merged
merged 6 commits into from Oct 14, 2018
Merged

128-bit integer support #110

merged 6 commits into from Oct 14, 2018

Conversation

asomers
Copy link
Contributor

@asomers asomers commented Oct 11, 2018

i128 and u128 can now be serialized and deserialized. Support is conditionalized on the disabled-by-default i128 feature flag, and requires rustc 1.26.0 or later. The minimum required version of Serde is now 1.0.60.

i128 and u128 can now be serialized and deserialized.  Support is
conditionalized on the disabled-by-default `i128` feature flag, and
requires rustc 1.26.0 or later.  The minimum required version of Serde
is now 1.0.60.

Fixes dtolnay#108
@asomers
Copy link
Contributor Author

asomers commented Oct 11, 2018

Sigh, Travis seems to be skipping CI for the entire PR, not just that one commit. I'll try to fix it.

@dtolnay
Copy link
Owner

dtolnay commented Oct 11, 2018

What part of this makes it necessary to have an i128 feature in Cargo.toml? Can you do it without a feature?

@asomers
Copy link
Contributor Author

asomers commented Oct 11, 2018

I could remove the feature. The biggest downside I see is that consumers could accidentally write code that fails to compile with older compilers. But if they're using i128 anyway, then they already have that problem.

@dtolnay
Copy link
Owner

dtolnay commented Oct 11, 2018

Users can always accidentally write code that fails to compile with older compilers, so I would prefer not to add a Cargo feature for that reason.

@asomers
Copy link
Contributor Author

asomers commented Oct 11, 2018

Ok, I'll remove it. BTW, the main reason I used a feature was just because bincode did. Though in bincode's case, the feature also pulls in another dependency.

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I landed this without the changes to serde_yaml::Value. Typically for the use cases of Value either 64 bits is good enough or they actually need arbitrary precision (similar to serde_json/arbitrary_precision).

@dtolnay dtolnay merged commit e689e30 into dtolnay:master Oct 14, 2018
@asomers
Copy link
Contributor Author

asomers commented Oct 14, 2018

Works for me. Value is only used when you don't know the schema ahead of time, right? In my case, I do. As long as I can deserialize into a u128, I'm happy.

@dtolnay
Copy link
Owner

dtolnay commented Oct 14, 2018

Correct. Deserializing into u128 will support numbers up to 128 bits.

I published this change in 0.8.6.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants