Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport 128bit integers #236
Closed
Comments
|
Hmm actually, if we wanted to do something with an explicit impl Serializer {
#[cfg(feature = "i128")]
fn serialize_i128(self, v: i128) -> Result<Self::Ok, Self::Error> {
// use `byteorder` to serialize our value
}
serde_if_integer128! {
#[cfg(not(feature = "i128"))]
fn serialize_i128(self, v: i128) -> Result<Self::Ok, Self::Error> {
let _ = v;
Err(Error::custom("i128 is not supported. Enable the `i128` feature of `bincode`"))
}
...
}
}So that enabling it always tried to implement the method, but if it's available and not implemented then we suggest the feature. |
|
This looks like a good plan! Would you feel comfortable implementing it? If not, I can get to it later this week. |
|
@TyOverby Sure! I'm happy to submit a PR for this. |
|
Hi @TyOverby! Are you happy to push out a |
|
Published! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
serde1.0.621.0.60was recently released with optional support for 128bit numbers. It would be good if we could wire them up tobincode. There's a convenientserde_if_integer128!macro thatserdeexposes we could use to automatically detect newer compilers, but that might not line up so well withbyteorder's expliciti128feature. Maybe we could do something like this:In
Cargo.toml:In
ser.rsorde.rs:so that vanilla
bincodekeeps working on older compilers, but has a more helpful error message if you accidentally use 128bit numbers without enabling the feature?Or maybe we could work around it using some
build.rswizardry?