mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-23 21:08:00 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 398fba9b1e | |||
| cd6697b0e4 | |||
| c162d51866 | |||
| 78a9dbc57e | |||
| 391d3ababf | |||
| 99d9151ce9 |
+2
-2
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde"
|
||||
version = "1.0.119" # remember to update html_root_url and serde_derive dependency
|
||||
version = "1.0.120" # remember to update html_root_url and serde_derive dependency
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "A generic serialization/deserialization framework"
|
||||
@@ -14,7 +14,7 @@ include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APAC
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
serde_derive = { version = "=1.0.119", optional = true, path = "../serde_derive" }
|
||||
serde_derive = { version = "=1.0.120", optional = true, path = "../serde_derive" }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_derive = { version = "1.0", path = "../serde_derive" }
|
||||
|
||||
@@ -130,12 +130,28 @@ impl<'de> Visitor<'de> for IgnoredAny {
|
||||
Ok(IgnoredAny)
|
||||
}
|
||||
|
||||
serde_if_integer128! {
|
||||
#[inline]
|
||||
fn visit_i128<E>(self, x: i128) -> Result<Self::Value, E> {
|
||||
let _ = x;
|
||||
Ok(IgnoredAny)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_u64<E>(self, x: u64) -> Result<Self::Value, E> {
|
||||
let _ = x;
|
||||
Ok(IgnoredAny)
|
||||
}
|
||||
|
||||
serde_if_integer128! {
|
||||
#[inline]
|
||||
fn visit_u128<E>(self, x: u128) -> Result<Self::Value, E> {
|
||||
let _ = x;
|
||||
Ok(IgnoredAny)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_f64<E>(self, x: f64) -> Result<Self::Value, E> {
|
||||
let _ = x;
|
||||
|
||||
+40
-72
@@ -1260,24 +1260,7 @@ macro_rules! parse_ip_impl {
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
if deserializer.is_human_readable() {
|
||||
struct IpAddrVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for IpAddrVisitor {
|
||||
type Value = $ty;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str($expecting)
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: Error,
|
||||
{
|
||||
s.parse().map_err(Error::custom)
|
||||
}
|
||||
}
|
||||
|
||||
deserializer.deserialize_str(IpAddrVisitor)
|
||||
deserializer.deserialize_str(FromStrVisitor::new($expecting))
|
||||
} else {
|
||||
<[u8; $size]>::deserialize(deserializer).map(<$ty>::from)
|
||||
}
|
||||
@@ -1405,24 +1388,7 @@ impl<'de> Deserialize<'de> for net::IpAddr {
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
if deserializer.is_human_readable() {
|
||||
struct IpAddrVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for IpAddrVisitor {
|
||||
type Value = net::IpAddr;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("IP address")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: Error,
|
||||
{
|
||||
s.parse().map_err(Error::custom)
|
||||
}
|
||||
}
|
||||
|
||||
deserializer.deserialize_str(IpAddrVisitor)
|
||||
deserializer.deserialize_str(FromStrVisitor::new("IP address"))
|
||||
} else {
|
||||
use lib::net::IpAddr;
|
||||
deserialize_enum! {
|
||||
@@ -1449,24 +1415,7 @@ macro_rules! parse_socket_impl {
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
if deserializer.is_human_readable() {
|
||||
struct SocketAddrVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for SocketAddrVisitor {
|
||||
type Value = $ty;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str($expecting)
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: Error,
|
||||
{
|
||||
s.parse().map_err(Error::custom)
|
||||
}
|
||||
}
|
||||
|
||||
deserializer.deserialize_str(SocketAddrVisitor)
|
||||
deserializer.deserialize_str(FromStrVisitor::new($expecting))
|
||||
} else {
|
||||
<(_, u16)>::deserialize(deserializer).map(|(ip, port)| $new(ip, port))
|
||||
}
|
||||
@@ -1482,24 +1431,7 @@ impl<'de> Deserialize<'de> for net::SocketAddr {
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
if deserializer.is_human_readable() {
|
||||
struct SocketAddrVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for SocketAddrVisitor {
|
||||
type Value = net::SocketAddr;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("socket address")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: Error,
|
||||
{
|
||||
s.parse().map_err(Error::custom)
|
||||
}
|
||||
}
|
||||
|
||||
deserializer.deserialize_str(SocketAddrVisitor)
|
||||
deserializer.deserialize_str(FromStrVisitor::new("socket address"))
|
||||
} else {
|
||||
use lib::net::SocketAddr;
|
||||
deserialize_enum! {
|
||||
@@ -2603,3 +2535,39 @@ atomic_impl! {
|
||||
atomic_impl! {
|
||||
AtomicI64 AtomicU64
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
struct FromStrVisitor<T> {
|
||||
expecting: &'static str,
|
||||
ty: PhantomData<T>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T> FromStrVisitor<T> {
|
||||
fn new(expecting: &'static str) -> Self {
|
||||
FromStrVisitor {
|
||||
expecting: expecting,
|
||||
ty: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<'de, T> Visitor<'de> for FromStrVisitor<T>
|
||||
where
|
||||
T: str::FromStr,
|
||||
T::Err: fmt::Display,
|
||||
{
|
||||
type Value = T;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str(self.expecting)
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: Error,
|
||||
{
|
||||
s.parse().map_err(Error::custom)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Serde types in rustdoc of other crates get linked to here.
|
||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.119")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.120")]
|
||||
// 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde_derive"
|
||||
version = "1.0.119" # remember to update html_root_url
|
||||
version = "1.0.120" # remember to update html_root_url
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//!
|
||||
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.119")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.120")]
|
||||
#![allow(unknown_lints, bare_trait_objects)]
|
||||
#![deny(clippy::all, clippy::pedantic)]
|
||||
// Ignored clippy lints
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde_test"
|
||||
version = "1.0.119" # remember to update html_root_url
|
||||
version = "1.0.120" # remember to update html_root_url
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Token De/Serializer for testing De/Serialize implementations"
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
//! # }
|
||||
//! ```
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.119")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.120")]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
|
||||
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
||||
// Ignored clippy lints
|
||||
|
||||
Reference in New Issue
Block a user