mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-05-01 12:28:01 +00:00
Implement Ser+De for Saturating<T>
The serialization implementation is heavily inspired by the existing trait implentation for `std::num::Wrapping<T>`. The deserializing implementation maps input values that lie outside of the numerical range of the output type to the `MIN` or `MAX` value of the output type, depending on the sign of the input value. This behaviour follows to the `Saturating` semantics of the output type. fix #2708
This commit is contained in:
@@ -64,6 +64,12 @@ fn main() {
|
||||
if minor < 64 {
|
||||
println!("cargo:rustc-cfg=no_core_cstr");
|
||||
}
|
||||
|
||||
// Support for core::num::Saturating and std::num::Saturating stabilized in Rust 1.74
|
||||
// https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html#stabilized-apis
|
||||
if minor < 74 {
|
||||
println!("cargo:rustc-cfg=no_core_num_saturating");
|
||||
}
|
||||
}
|
||||
|
||||
fn rustc_minor_version() -> Option<u32> {
|
||||
|
||||
Reference in New Issue
Block a user