From 6f15a0e1b2a0ed23ffedf44c4d6a3b52f2727d8e Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Tue, 27 Jul 2021 19:09:38 +0200 Subject: [PATCH] Add doc(cfg(feature = "std")) attribute where appropriate --- src/de.rs | 1 + src/lib.rs | 1 + src/read.rs | 1 + src/ser.rs | 3 +++ 4 files changed, 6 insertions(+) diff --git a/src/de.rs b/src/de.rs index 2041f537c..c2245724b 100644 --- a/src/de.rs +++ b/src/de.rs @@ -2492,6 +2492,7 @@ where /// the JSON map or some number is too big to fit in the expected primitive /// type. #[cfg(feature = "std")] +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] pub fn from_reader(rdr: R) -> Result where R: crate::io::Read, diff --git a/src/lib.rs b/src/lib.rs index 737ad833e..b705f1c74 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -454,6 +454,7 @@ pub mod de; pub mod error; pub mod map; #[cfg(feature = "std")] +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] pub mod ser; #[cfg(not(feature = "std"))] mod ser; diff --git a/src/read.rs b/src/read.rs index 5a0e8f612..8ed3d7d83 100644 --- a/src/read.rs +++ b/src/read.rs @@ -140,6 +140,7 @@ where /// JSON input source that reads from a std::io input stream. #[cfg(feature = "std")] +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] pub struct IoRead where R: io::Read, diff --git a/src/ser.rs b/src/ser.rs index 0bf48b6bf..54b0bf220 100644 --- a/src/ser.rs +++ b/src/ser.rs @@ -8,6 +8,7 @@ use serde::ser::{self, Impossible, Serialize}; use serde::serde_if_integer128; /// A structure for serializing Rust values into JSON. +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] pub struct Serializer { writer: W, formatter: F, @@ -2141,6 +2142,7 @@ static ESCAPE: [u8; 256] = [ /// Serialization can fail if `T`'s implementation of `Serialize` decides to /// fail, or if `T` contains a map with non-string keys. #[inline] +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] pub fn to_writer(writer: W, value: &T) -> Result<()> where W: io::Write, @@ -2159,6 +2161,7 @@ where /// Serialization can fail if `T`'s implementation of `Serialize` decides to /// fail, or if `T` contains a map with non-string keys. #[inline] +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] pub fn to_writer_pretty(writer: W, value: &T) -> Result<()> where W: io::Write,