summaryrefslogtreecommitdiffstats
path: root/vendor/serde/src
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/serde/src')
-rw-r--r--vendor/serde/src/de/impls.rs26
-rw-r--r--vendor/serde/src/lib.rs9
2 files changed, 31 insertions, 4 deletions
diff --git a/vendor/serde/src/de/impls.rs b/vendor/serde/src/de/impls.rs
index fbee1554b..b7e4c549d 100644
--- a/vendor/serde/src/de/impls.rs
+++ b/vendor/serde/src/de/impls.rs
@@ -180,6 +180,28 @@ macro_rules! num_as_self {
};
}
+macro_rules! num_as_copysign_self {
+ ($ty:ident : $visit:ident) => {
+ #[inline]
+ fn $visit<E>(self, v: $ty) -> Result<Self::Value, E>
+ where
+ E: Error,
+ {
+ #[cfg(any(no_float_copysign, not(feature = "std")))]
+ {
+ Ok(v as Self::Value)
+ }
+
+ #[cfg(all(not(no_float_copysign), feature = "std"))]
+ {
+ // Preserve sign of NaN. The `as` produces a nondeterministic sign.
+ let sign = if v.is_sign_positive() { 1.0 } else { -1.0 };
+ Ok((v as Self::Value).copysign(sign))
+ }
+ }
+ };
+}
+
macro_rules! int_to_int {
($ty:ident : $visit:ident) => {
#[inline]
@@ -351,7 +373,7 @@ impl_deserialize_num! {
impl_deserialize_num! {
f32, deserialize_f32
num_self!(f32:visit_f32);
- num_as_self!(f64:visit_f64);
+ num_as_copysign_self!(f64:visit_f64);
num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
}
@@ -359,7 +381,7 @@ impl_deserialize_num! {
impl_deserialize_num! {
f64, deserialize_f64
num_self!(f64:visit_f64);
- num_as_self!(f32:visit_f32);
+ num_as_copysign_self!(f32:visit_f32);
num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
}
diff --git a/vendor/serde/src/lib.rs b/vendor/serde/src/lib.rs
index f7d445749..8c6a4affc 100644
--- a/vendor/serde/src/lib.rs
+++ b/vendor/serde/src/lib.rs
@@ -63,6 +63,7 @@
//! and from DynamoDB.
//! - [Hjson], a syntax extension to JSON designed around human reading and
//! editing. *(deserialization only)*
+//! - [CSV], Comma-separated values is a tabular text file format.
//!
//! [JSON]: https://github.com/serde-rs/json
//! [Postcard]: https://github.com/jamesmunns/postcard
@@ -89,11 +90,12 @@
//! [DynamoDB Items]: https://docs.rs/serde_dynamo
//! [rusoto_dynamodb]: https://docs.rs/rusoto_dynamodb
//! [Hjson]: https://github.com/Canop/deser-hjson
+//! [CSV]: https://docs.rs/csv
////////////////////////////////////////////////////////////////////////////////
// Serde types in rustdoc of other crates get linked to here.
-#![doc(html_root_url = "https://docs.rs/serde/1.0.188")]
+#![doc(html_root_url = "https://docs.rs/serde/1.0.190")]
// Support using Serde without the standard library!
#![cfg_attr(not(feature = "std"), no_std)]
// Unstable functionality only if the user asks for it. For tracking and
@@ -166,11 +168,14 @@ mod lib {
pub use std::*;
}
- pub use self::core::{cmp, iter, mem, num, ptr, slice, str};
pub use self::core::{f32, f64};
pub use self::core::{i16, i32, i64, i8, isize};
+ pub use self::core::{iter, num, ptr, str};
pub use self::core::{u16, u32, u64, u8, usize};
+ #[cfg(any(feature = "std", feature = "alloc"))]
+ pub use self::core::{cmp, mem, slice};
+
pub use self::core::cell::{Cell, RefCell};
pub use self::core::clone::{self, Clone};
pub use self::core::cmp::Reverse;