Compare commits

...

29 Commits

Author SHA1 Message Date
David Tolnay ccf9c6fc07 Release 1.0.152 2022-12-26 09:21:13 -08:00
David Tolnay b25d0ea7f9 Link to Hjson data format 2022-12-26 09:20:12 -08:00
David Tolnay 4f4557fd05 Link to bencode data format 2022-12-26 09:18:48 -08:00
David Tolnay bf400d6799 Link to serde_tokenstream data format 2022-12-26 09:14:59 -08:00
David Tolnay 4d2e36d19b Wrap flexbuffers bullet point to 80 columns 2022-12-26 09:14:23 -08:00
David Tolnay df6310e5f5 Merge pull request #2347 from dtolnay/docsrs
Replace docs.serde.rs links
2022-12-18 11:55:43 -08:00
David Tolnay 938ab5ddec Replace docs.serde.rs links with intra-rustdoc links 2022-12-18 11:48:57 -08:00
David Tolnay ef5a0de384 Point documentation links to docs.rs instead of docs.serde.rs 2022-12-18 11:45:23 -08:00
David Tolnay 5d186c77a6 Opt out -Zrustdoc-scrape-examples on docs.rs
I'd like a chance to audit all the code that rustdoc is inserting into
the docs. Currently I am skeptical that showing serde's internal usages
of APIs is a net benefit to the public documentation. I am also
skeptical that quite so many examples are needed, and that they should
be featured so prominently in comparison to handwritten docs. Lastly I
wish there were a way to turn this behavior off on a more granular
basis.
2022-12-18 09:31:17 -08:00
David Tolnay 44bf3633af Release 1.0.151 2022-12-16 10:35:12 -08:00
David Tolnay f261184416 Merge pull request #2344 from dtolnay/coreerror
Make StdError identical to core::error::Error on feature="unstable"
2022-12-16 10:22:04 -08:00
David Tolnay df40f80fcf Make StdError identical to core::error::Error on feature="unstable" 2022-12-16 10:11:37 -08:00
David Tolnay e7060ba83d Merge pull request #2342 from atouchet/badges
Update build status badge
2022-12-15 17:54:07 -08:00
Alex Touchet d98f0eea3d Update build status badge 2022-12-15 17:17:05 -08:00
David Tolnay 4f157a8b81 Prevent build.rs rerunning unnecessarily on all source changes 2022-12-12 14:37:41 -08:00
David Tolnay d493649f52 Release 1.0.150 2022-12-11 16:24:46 -08:00
David Tolnay 0e947e6c3b Merge pull request #2338 from serde-rs/atomic
Deduplicate atomic_impl implementations and atomic_impl calls from PR 2337
2022-12-11 16:22:28 -08:00
David Tolnay 9249dab54c Deduplicate atomic_impl macro calls 2022-12-11 16:12:51 -08:00
David Tolnay 7440e56c53 Deduplicate atomic_impl macro implementations 2022-12-11 16:09:26 -08:00
David Tolnay 0d79306285 Update atomic_impl macros to have same input syntax in all cfgs 2022-12-11 16:01:58 -08:00
David Tolnay 37faaf295e Mention target_has_atomic stabilization 2022-12-11 15:56:31 -08:00
David Tolnay 650358fa00 Replace obsolete comment about target_has_atomic support 2022-12-11 15:55:19 -08:00
David Tolnay 6159ead404 Invert use_target_has_atomic cfg
This way, a build system that does not want to run Cargo build scripts
can build serde without any cfgs defined, and get the most modern
feature set.
2022-12-11 15:51:19 -08:00
David Tolnay 692ac99c69 Format PR 2337 with rustfmt 2022-12-11 15:48:30 -08:00
David Tolnay 86161ce15f Adjust spacing in some macro matchers 2022-12-11 15:48:30 -08:00
David Tolnay 5361c790bb Merge pull request #2337 from badboy/use-target_has_atomic-when-available
Use `target_has_atomic` on Rust 1.60+ to enable atomic (de)serialization
2022-12-11 15:42:00 -08:00
Jan-Erik Rediger 126730edc8 Use target_has_atomic on Rust 1.60+ to enable atomic (de)serialization 2022-12-11 13:34:07 +01:00
David Tolnay 3aec2a96a8 Merge pull request #2334 from dtolnay/mapimpl
Reduce trait bounds in HashMap and BTreeMap serialize
2022-12-04 23:27:03 -08:00
David Tolnay 227d039b1e Reduce trait bounds in HashMap and BTreeMap serialize 2022-12-04 23:18:02 -08:00
18 changed files with 150 additions and 76 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.13+]][Rust 1.13] [![serde_derive: rustc 1.31+]][Rust 1.31] # Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.13+]][Rust 1.13] [![serde_derive: rustc 1.31+]][Rust 1.31]
[Build Status]: https://img.shields.io/github/workflow/status/serde-rs/serde/CI/master [Build Status]: https://img.shields.io/github/actions/workflow/status/serde-rs/serde/ci.yml?branch=master
[actions]: https://github.com/serde-rs/serde/actions?query=branch%3Amaster [actions]: https://github.com/serde-rs/serde/actions?query=branch%3Amaster
[Latest Version]: https://img.shields.io/crates/v/serde.svg [Latest Version]: https://img.shields.io/crates/v/serde.svg
[crates.io]: https://crates.io/crates/serde [crates.io]: https://crates.io/crates/serde
@@ -19,7 +19,7 @@ You may be looking for:
- [Data formats supported by Serde](https://serde.rs/#data-formats) - [Data formats supported by Serde](https://serde.rs/#data-formats)
- [Setting up `#[derive(Serialize, Deserialize)]`](https://serde.rs/derive.html) - [Setting up `#[derive(Serialize, Deserialize)]`](https://serde.rs/derive.html)
- [Examples](https://serde.rs/examples.html) - [Examples](https://serde.rs/examples.html)
- [API documentation](https://docs.serde.rs/serde/) - [API documentation](https://docs.rs/serde)
- [Release notes](https://github.com/serde-rs/serde/releases) - [Release notes](https://github.com/serde-rs/serde/releases)
## Serde in action ## Serde in action
+1 -1
View File
@@ -10,7 +10,7 @@ You may be looking for:
- [Data formats supported by Serde](https://serde.rs/#data-formats) - [Data formats supported by Serde](https://serde.rs/#data-formats)
- [Setting up `#[derive(Serialize, Deserialize)]`](https://serde.rs/derive.html) - [Setting up `#[derive(Serialize, Deserialize)]`](https://serde.rs/derive.html)
- [Examples](https://serde.rs/examples.html) - [Examples](https://serde.rs/examples.html)
- [API documentation](https://docs.serde.rs/serde/) - [API documentation](https://docs.rs/serde)
- [Release notes](https://github.com/serde-rs/serde/releases) - [Release notes](https://github.com/serde-rs/serde/releases)
## Serde in action ## Serde in action
+6 -3
View File
@@ -1,11 +1,11 @@
[package] [package]
name = "serde" name = "serde"
version = "1.0.149" # remember to update html_root_url and serde_derive dependency version = "1.0.152" # remember to update html_root_url and serde_derive dependency
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
build = "build.rs" build = "build.rs"
categories = ["encoding", "no-std"] categories = ["encoding", "no-std"]
description = "A generic serialization/deserialization framework" description = "A generic serialization/deserialization framework"
documentation = "https://docs.serde.rs/serde/" documentation = "https://docs.rs/serde"
homepage = "https://serde.rs" homepage = "https://serde.rs"
include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
keywords = ["serde", "serialization", "no_std"] keywords = ["serde", "serialization", "no_std"]
@@ -15,11 +15,14 @@ repository = "https://github.com/serde-rs/serde"
rust-version = "1.13" rust-version = "1.13"
[dependencies] [dependencies]
serde_derive = { version = "=1.0.149", optional = true, path = "../serde_derive" } serde_derive = { version = "=1.0.152", optional = true, path = "../serde_derive" }
[dev-dependencies] [dev-dependencies]
serde_derive = { version = "1.0", path = "../serde_derive" } serde_derive = { version = "1.0", path = "../serde_derive" }
[lib]
doc-scrape-examples = false
[package.metadata.playground] [package.metadata.playground]
features = ["derive", "rc"] features = ["derive", "rc"]
+8 -3
View File
@@ -6,6 +6,8 @@ use std::str::{self, FromStr};
// opening a GitHub issue if your build environment requires some way to enable // opening a GitHub issue if your build environment requires some way to enable
// these cfgs other than by executing our build script. // these cfgs other than by executing our build script.
fn main() { fn main() {
println!("cargo:rerun-if-changed=build.rs");
let minor = match rustc_minor_version() { let minor = match rustc_minor_version() {
Some(minor) => minor, Some(minor) => minor,
None => return, None => return,
@@ -92,9 +94,11 @@ fn main() {
println!("cargo:rustc-cfg=no_relaxed_trait_bounds"); println!("cargo:rustc-cfg=no_relaxed_trait_bounds");
} }
// Whitelist of archs that support std::sync::atomic module. Ideally we // Support for #[cfg(target_has_atomic = "...")] stabilized in Rust 1.60.
// would use #[cfg(target_has_atomic = "...")] but it is not stable yet. if minor < 60 {
// Instead this is based on rustc's compiler/rustc_target/src/spec/*.rs. println!("cargo:rustc-cfg=no_target_has_atomic");
// Allowlist of archs that support std::sync::atomic module. This is
// based on rustc's compiler/rustc_target/src/spec/*.rs.
let has_atomic64 = target.starts_with("x86_64") let has_atomic64 = target.starts_with("x86_64")
|| target.starts_with("i686") || target.starts_with("i686")
|| target.starts_with("aarch64") || target.starts_with("aarch64")
@@ -110,6 +114,7 @@ fn main() {
println!("cargo:rustc-cfg=no_std_atomic"); println!("cargo:rustc-cfg=no_std_atomic");
} }
} }
}
fn rustc_minor_version() -> Option<u32> { fn rustc_minor_version() -> Option<u32> {
let rustc = match env::var_os("RUSTC") { let rustc = match env::var_os("RUSTC") {
+13 -5
View File
@@ -2662,8 +2662,9 @@ where
#[cfg(all(feature = "std", not(no_std_atomic)))] #[cfg(all(feature = "std", not(no_std_atomic)))]
macro_rules! atomic_impl { macro_rules! atomic_impl {
($($ty:ident)*) => { ($($ty:ident $size:expr)*) => {
$( $(
#[cfg(any(no_target_has_atomic, target_has_atomic = $size))]
impl<'de> Deserialize<'de> for $ty { impl<'de> Deserialize<'de> for $ty {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where where
@@ -2678,14 +2679,21 @@ macro_rules! atomic_impl {
#[cfg(all(feature = "std", not(no_std_atomic)))] #[cfg(all(feature = "std", not(no_std_atomic)))]
atomic_impl! { atomic_impl! {
AtomicBool AtomicBool "8"
AtomicI8 AtomicI16 AtomicI32 AtomicIsize AtomicI8 "8"
AtomicU8 AtomicU16 AtomicU32 AtomicUsize AtomicI16 "16"
AtomicI32 "32"
AtomicIsize "ptr"
AtomicU8 "8"
AtomicU16 "16"
AtomicU32 "32"
AtomicUsize "ptr"
} }
#[cfg(all(feature = "std", not(no_std_atomic64)))] #[cfg(all(feature = "std", not(no_std_atomic64)))]
atomic_impl! { atomic_impl! {
AtomicI64 AtomicU64 AtomicI64 "64"
AtomicU64 "64"
} }
#[cfg(feature = "std")] #[cfg(feature = "std")]
+2 -3
View File
@@ -501,8 +501,8 @@ impl<'a> Display for Expected + 'a {
/// by Serde. /// by Serde.
/// ///
/// Serde provides `Deserialize` implementations for many Rust primitive and /// Serde provides `Deserialize` implementations for many Rust primitive and
/// standard library types. The complete list is [here][de]. All of these can /// standard library types. The complete list is [here][crate::de]. All of these
/// be deserialized using Serde out of the box. /// can be deserialized using Serde out of the box.
/// ///
/// Additionally, Serde provides a procedural macro called `serde_derive` to /// Additionally, Serde provides a procedural macro called `serde_derive` to
/// automatically generate `Deserialize` implementations for structs and enums /// automatically generate `Deserialize` implementations for structs and enums
@@ -518,7 +518,6 @@ impl<'a> Display for Expected + 'a {
/// `LinkedHashMap<K, V>` type that is deserializable by Serde because the crate /// `LinkedHashMap<K, V>` type that is deserializable by Serde because the crate
/// provides an implementation of `Deserialize` for it. /// provides an implementation of `Deserialize` for it.
/// ///
/// [de]: https://docs.serde.rs/serde/de/index.html
/// [derive]: https://serde.rs/derive.html /// [derive]: https://serde.rs/derive.html
/// [impl-deserialize]: https://serde.rs/impl-deserialize.html /// [impl-deserialize]: https://serde.rs/impl-deserialize.html
/// ///
+28 -6
View File
@@ -52,9 +52,15 @@
//! - [S-expressions], the textual representation of code and data used by the //! - [S-expressions], the textual representation of code and data used by the
//! Lisp language family. //! Lisp language family.
//! - [D-Bus]'s binary wire format. //! - [D-Bus]'s binary wire format.
//! - [FlexBuffers], the schemaless cousin of Google's FlatBuffers zero-copy serialization format. //! - [FlexBuffers], the schemaless cousin of Google's FlatBuffers zero-copy
//! serialization format.
//! - [Bencode], a simple binary format used in the BitTorrent protocol.
//! - [Token streams], for processing Rust procedural macro input.
//! *(deserialization only)*
//! - [DynamoDB Items], the format used by [rusoto_dynamodb] to transfer data to //! - [DynamoDB Items], the format used by [rusoto_dynamodb] to transfer data to
//! and from DynamoDB. //! and from DynamoDB.
//! - [Hjson], a syntax extension to JSON designed around human reading and
//! editing. *(deserialization only)*
//! //!
//! [JSON]: https://github.com/serde-rs/json //! [JSON]: https://github.com/serde-rs/json
//! [Postcard]: https://github.com/jamesmunns/postcard //! [Postcard]: https://github.com/jamesmunns/postcard
@@ -75,20 +81,23 @@
//! [S-expressions]: https://github.com/rotty/lexpr-rs //! [S-expressions]: https://github.com/rotty/lexpr-rs
//! [D-Bus]: https://docs.rs/zvariant //! [D-Bus]: https://docs.rs/zvariant
//! [FlexBuffers]: https://github.com/google/flatbuffers/tree/master/rust/flexbuffers //! [FlexBuffers]: https://github.com/google/flatbuffers/tree/master/rust/flexbuffers
//! [Bencode]: https://github.com/P3KI/bendy
//! [Token streams]: https://github.com/oxidecomputer/serde_tokenstream
//! [DynamoDB Items]: https://docs.rs/serde_dynamo //! [DynamoDB Items]: https://docs.rs/serde_dynamo
//! [rusoto_dynamodb]: https://docs.rs/rusoto_dynamodb //! [rusoto_dynamodb]: https://docs.rs/rusoto_dynamodb
//! [Hjson]: https://github.com/Canop/deser-hjson
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Serde types in rustdoc of other crates get linked to here. // Serde types in rustdoc of other crates get linked to here.
#![doc(html_root_url = "https://docs.rs/serde/1.0.149")] #![doc(html_root_url = "https://docs.rs/serde/1.0.152")]
// Support using Serde without the standard library! // Support using Serde without the standard library!
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// Unstable functionality only if the user asks for it. For tracking and // Unstable functionality only if the user asks for it. For tracking and
// discussion of these features please refer to this issue: // discussion of these features please refer to this issue:
// //
// https://github.com/serde-rs/serde/issues/812 // https://github.com/serde-rs/serde/issues/812
#![cfg_attr(feature = "unstable", feature(never_type))] #![cfg_attr(feature = "unstable", feature(error_in_core, never_type))]
#![allow(unknown_lints, bare_trait_objects, deprecated)] #![allow(unknown_lints, bare_trait_objects, deprecated)]
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
// Ignored clippy and clippy_pedantic lints // Ignored clippy and clippy_pedantic lints
@@ -236,14 +245,27 @@ mod lib {
#[cfg(not(no_range_inclusive))] #[cfg(not(no_range_inclusive))]
pub use self::core::ops::RangeInclusive; pub use self::core::ops::RangeInclusive;
#[cfg(all(feature = "std", not(no_std_atomic)))] #[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))]
pub use std::sync::atomic::{ pub use std::sync::atomic::{
AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8, AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8,
AtomicUsize, Ordering, AtomicUsize, Ordering,
}; };
#[cfg(all(feature = "std", not(no_std_atomic64)))] #[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic64)))]
pub use std::sync::atomic::{AtomicI64, AtomicU64}; pub use std::sync::atomic::{AtomicI64, AtomicU64};
#[cfg(all(feature = "std", not(no_target_has_atomic)))]
pub use std::sync::atomic::Ordering;
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "8"))]
pub use std::sync::atomic::{AtomicBool, AtomicI8, AtomicU8};
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "16"))]
pub use std::sync::atomic::{AtomicI16, AtomicU16};
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "32"))]
pub use std::sync::atomic::{AtomicI32, AtomicU32};
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "64"))]
pub use std::sync::atomic::{AtomicI64, AtomicU64};
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "ptr"))]
pub use std::sync::atomic::{AtomicIsize, AtomicUsize};
#[cfg(any(feature = "std", not(no_core_duration)))] #[cfg(any(feature = "std", not(no_core_duration)))]
pub use self::core::time::Duration; pub use self::core::time::Duration;
} }
@@ -290,7 +312,7 @@ use self::__private as private;
#[path = "de/seed.rs"] #[path = "de/seed.rs"]
mod seed; mod seed;
#[cfg(not(feature = "std"))] #[cfg(not(any(feature = "std", feature = "unstable")))]
mod std_error; mod std_error;
// Re-export #[derive(Serialize, Deserialize)]. // Re-export #[derive(Serialize, Deserialize)].
+33 -6
View File
@@ -365,7 +365,26 @@ tuple_impls! {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(all(any(feature = "std", feature = "alloc"), not(no_relaxed_trait_bounds)))]
macro_rules! map_impl {
($ty:ident <K $(: $kbound1:ident $(+ $kbound2:ident)*)*, V $(, $typaram:ident : $bound:ident)*>) => {
impl<K, V $(, $typaram)*> Serialize for $ty<K, V $(, $typaram)*>
where
K: Serialize,
V: Serialize,
{
#[inline]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.collect_map(self)
}
}
}
}
#[cfg(all(any(feature = "std", feature = "alloc"), no_relaxed_trait_bounds))]
macro_rules! map_impl { macro_rules! map_impl {
($ty:ident <K $(: $kbound1:ident $(+ $kbound2:ident)*)*, V $(, $typaram:ident : $bound:ident)*>) => { ($ty:ident <K $(: $kbound1:ident $(+ $kbound2:ident)*)*, V $(, $typaram:ident : $bound:ident)*>) => {
impl<K, V $(, $typaram)*> Serialize for $ty<K, V $(, $typaram)*> impl<K, V $(, $typaram)*> Serialize for $ty<K, V $(, $typaram)*>
@@ -928,8 +947,9 @@ where
#[cfg(all(feature = "std", not(no_std_atomic)))] #[cfg(all(feature = "std", not(no_std_atomic)))]
macro_rules! atomic_impl { macro_rules! atomic_impl {
($($ty:ident)*) => { ($($ty:ident $size:expr)*) => {
$( $(
#[cfg(any(no_target_has_atomic, target_has_atomic = $size))]
impl Serialize for $ty { impl Serialize for $ty {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@@ -945,12 +965,19 @@ macro_rules! atomic_impl {
#[cfg(all(feature = "std", not(no_std_atomic)))] #[cfg(all(feature = "std", not(no_std_atomic)))]
atomic_impl! { atomic_impl! {
AtomicBool AtomicBool "8"
AtomicI8 AtomicI16 AtomicI32 AtomicIsize AtomicI8 "8"
AtomicU8 AtomicU16 AtomicU32 AtomicUsize AtomicI16 "16"
AtomicI32 "32"
AtomicIsize "ptr"
AtomicU8 "8"
AtomicU16 "16"
AtomicU32 "32"
AtomicUsize "ptr"
} }
#[cfg(all(feature = "std", not(no_std_atomic64)))] #[cfg(all(feature = "std", not(no_std_atomic64)))]
atomic_impl! { atomic_impl! {
AtomicI64 AtomicU64 AtomicI64 "64"
AtomicU64 "64"
} }
+6 -4
View File
@@ -115,10 +115,13 @@ mod impossible;
pub use self::impossible::Impossible; pub use self::impossible::Impossible;
#[cfg(all(feature = "unstable", not(feature = "std")))]
#[doc(inline)]
pub use core::error::Error as StdError;
#[cfg(feature = "std")] #[cfg(feature = "std")]
#[doc(no_inline)] #[doc(no_inline)]
pub use std::error::Error as StdError; pub use std::error::Error as StdError;
#[cfg(not(feature = "std"))] #[cfg(not(any(feature = "std", feature = "unstable")))]
#[doc(no_inline)] #[doc(no_inline)]
pub use std_error::Error as StdError; pub use std_error::Error as StdError;
@@ -191,8 +194,8 @@ declare_error_trait!(Error: Sized + Debug + Display);
/// by Serde. /// by Serde.
/// ///
/// Serde provides `Serialize` implementations for many Rust primitive and /// Serde provides `Serialize` implementations for many Rust primitive and
/// standard library types. The complete list is [here][ser]. All of these can /// standard library types. The complete list is [here][crate::ser]. All of
/// be serialized using Serde out of the box. /// these can be serialized using Serde out of the box.
/// ///
/// Additionally, Serde provides a procedural macro called [`serde_derive`] to /// Additionally, Serde provides a procedural macro called [`serde_derive`] to
/// automatically generate `Serialize` implementations for structs and enums in /// automatically generate `Serialize` implementations for structs and enums in
@@ -212,7 +215,6 @@ declare_error_trait!(Error: Sized + Debug + Display);
/// [`linked-hash-map`]: https://crates.io/crates/linked-hash-map /// [`linked-hash-map`]: https://crates.io/crates/linked-hash-map
/// [`serde_derive`]: https://crates.io/crates/serde_derive /// [`serde_derive`]: https://crates.io/crates/serde_derive
/// [derive section of the manual]: https://serde.rs/derive.html /// [derive section of the manual]: https://serde.rs/derive.html
/// [ser]: https://docs.serde.rs/serde/ser/index.html
pub trait Serialize { pub trait Serialize {
/// Serialize this value into the given Serde serializer. /// Serialize this value into the given Serde serializer.
/// ///
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "serde_derive" name = "serde_derive"
version = "1.0.149" # remember to update html_root_url version = "1.0.152" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
categories = ["no-std"] categories = ["no-std"]
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]" description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
+2
View File
@@ -6,6 +6,8 @@ use std::str;
// opening a GitHub issue if your build environment requires some way to enable // opening a GitHub issue if your build environment requires some way to enable
// these cfgs other than by executing our build script. // these cfgs other than by executing our build script.
fn main() { fn main() {
println!("cargo:rerun-if-changed=build.rs");
let minor = match rustc_minor_version() { let minor = match rustc_minor_version() {
Some(minor) => minor, Some(minor) => minor,
None => return, None => return,
+1 -1
View File
@@ -13,7 +13,7 @@
//! //!
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html //! [https://serde.rs/derive.html]: https://serde.rs/derive.html
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.149")] #![doc(html_root_url = "https://docs.rs/serde_derive/1.0.152")]
#![allow(unknown_lints, bare_trait_objects)] #![allow(unknown_lints, bare_trait_objects)]
// Ignored clippy lints // Ignored clippy lints
#![allow( #![allow(
+3
View File
@@ -1,6 +1,9 @@
use std::path::Path; use std::path::Path;
fn main() { fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=src/mod.rs");
// Sometimes on Windows the git checkout does not correctly wire up the // Sometimes on Windows the git checkout does not correctly wire up the
// symlink from serde_derive_internals/src to serde_derive/src/internals. // symlink from serde_derive_internals/src to serde_derive/src/internals.
// When this happens we'll just build based on relative paths within the git // When this happens we'll just build based on relative paths within the git
+5 -2
View File
@@ -1,11 +1,11 @@
[package] [package]
name = "serde_test" name = "serde_test"
version = "1.0.149" # remember to update html_root_url version = "1.0.152" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
build = "build.rs" build = "build.rs"
categories = ["development-tools::testing"] categories = ["development-tools::testing"]
description = "Token De/Serializer for testing De/Serialize implementations" description = "Token De/Serializer for testing De/Serialize implementations"
documentation = "https://docs.serde.rs/serde_test/" documentation = "https://docs.rs/serde_test"
homepage = "https://serde.rs" homepage = "https://serde.rs"
include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
keywords = ["serde", "serialization", "testing", "dev-dependencies"] keywords = ["serde", "serialization", "testing", "dev-dependencies"]
@@ -21,5 +21,8 @@ serde = { version = "1.0.60", path = "../serde" }
serde = { version = "1.0", path = "../serde" } serde = { version = "1.0", path = "../serde" }
serde_derive = { version = "1.0", path = "../serde_derive" } serde_derive = { version = "1.0", path = "../serde_derive" }
[lib]
doc-scrape-examples = false
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]
+2
View File
@@ -6,6 +6,8 @@ use std::str::{self, FromStr};
// opening a GitHub issue if your build environment requires some way to enable // opening a GitHub issue if your build environment requires some way to enable
// these cfgs other than by executing our build script. // these cfgs other than by executing our build script.
fn main() { fn main() {
println!("cargo:rerun-if-changed=build.rs");
let minor = match rustc_minor_version() { let minor = match rustc_minor_version() {
Some(minor) => minor, Some(minor) => minor,
None => return, None => return,
+4 -8
View File
@@ -1,8 +1,8 @@
//! This crate provides a convenient concise way to write unit tests for //! This crate provides a convenient concise way to write unit tests for
//! implementations of [`Serialize`] and [`Deserialize`]. //! implementations of [`Serialize`] and [`Deserialize`].
//! //!
//! [`Serialize`]: https://docs.serde.rs/serde/ser/trait.Serialize.html //! [`Serialize`]: serde::ser::Serialize
//! [`Deserialize`]: https://docs.serde.rs/serde/de/trait.Deserialize.html //! [`Deserialize`]: serde::de::Deserialize
//! //!
//! The `Serialize` impl for a value can be characterized by the sequence of //! The `Serialize` impl for a value can be characterized by the sequence of
//! [`Serializer`] calls that are made in the course of serializing the value, //! [`Serializer`] calls that are made in the course of serializing the value,
@@ -14,11 +14,7 @@
//! test both directions. There are also functions to test expected failure //! test both directions. There are also functions to test expected failure
//! conditions. //! conditions.
//! //!
//! [`Serializer`]: https://docs.serde.rs/serde/ser/trait.Serializer.html //! [`Serializer`]: serde::ser::Serializer
//! [`Token`]: https://docs.serde.rs/serde_test/enum.Token.html
//! [`assert_ser_tokens`]: https://docs.serde.rs/serde_test/fn.assert_ser_tokens.html
//! [`assert_de_tokens`]: https://docs.serde.rs/serde_test/fn.assert_de_tokens.html
//! [`assert_tokens`]: https://docs.serde.rs/serde_test/fn.assert_tokens.html
//! //!
//! Here is an example from the [`linked-hash-map`] crate. //! Here is an example from the [`linked-hash-map`] crate.
//! //!
@@ -144,7 +140,7 @@
//! # } //! # }
//! ``` //! ```
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.149")] #![doc(html_root_url = "https://docs.rs/serde_test/1.0.152")]
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
// Ignored clippy lints // Ignored clippy lints
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, needless_doctest_main))] #![cfg_attr(feature = "cargo-clippy", allow(float_cmp, needless_doctest_main))]
+2
View File
@@ -19,6 +19,8 @@ fn has_cargo_expand() -> bool {
} }
fn main() { fn main() {
println!("cargo:rerun-if-changed=build.rs");
if cfg!(feature = "expandtest") && has_cargo_expand() { if cfg!(feature = "expandtest") && has_cargo_expand() {
println!("cargo:rustc-cfg=expandtest"); println!("cargo:rustc-cfg=expandtest");
} }