mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-13 17:11:02 +00:00
Move doctest-only helpers to a doc module
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
/// bother with this macro and may assume support for 128-bit integers.
|
/// bother with this macro and may assume support for 128-bit integers.
|
||||||
///
|
///
|
||||||
/// ```edition2018
|
/// ```edition2018
|
||||||
/// # use serde::__private::ser::Error;
|
/// # use serde::__private::doc::Error;
|
||||||
/// #
|
/// #
|
||||||
/// # struct MySerializer;
|
/// # struct MySerializer;
|
||||||
/// #
|
/// #
|
||||||
|
|||||||
@@ -1,3 +1,35 @@
|
|||||||
|
// Used only by Serde doc tests. Not public API.
|
||||||
|
|
||||||
|
use lib::*;
|
||||||
|
|
||||||
|
use ser;
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct Error;
|
||||||
|
|
||||||
|
impl ser::Error for Error {
|
||||||
|
fn custom<T>(_: T) -> Self
|
||||||
|
where
|
||||||
|
T: Display,
|
||||||
|
{
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
impl error::Error for Error {
|
||||||
|
fn description(&self) -> &str {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Display for Error {
|
||||||
|
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! __private_serialize {
|
macro_rules! __private_serialize {
|
||||||
@@ -10,7 +42,6 @@ macro_rules! __private_serialize {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used only by Serde doc tests. Not public API.
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[macro_export(local_inner_macros)]
|
#[macro_export(local_inner_macros)]
|
||||||
macro_rules! __serialize_unimplemented {
|
macro_rules! __serialize_unimplemented {
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
mod macros;
|
|
||||||
|
|
||||||
pub mod de;
|
pub mod de;
|
||||||
|
pub mod doc;
|
||||||
pub mod ser;
|
pub mod ser;
|
||||||
|
|
||||||
pub use lib::clone::Clone;
|
pub use lib::clone::Clone;
|
||||||
|
|||||||
@@ -335,33 +335,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used only by Serde doc tests. Not public API.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct Error;
|
|
||||||
|
|
||||||
impl ser::Error for Error {
|
|
||||||
fn custom<T>(_: T) -> Self
|
|
||||||
where
|
|
||||||
T: Display,
|
|
||||||
{
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
impl error::Error for Error {
|
|
||||||
fn description(&self) -> &str {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for Error {
|
|
||||||
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||||
mod content {
|
mod content {
|
||||||
use lib::*;
|
use lib::*;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use ser::{
|
|||||||
///
|
///
|
||||||
/// ```edition2018
|
/// ```edition2018
|
||||||
/// # use serde::ser::{Serializer, Impossible};
|
/// # use serde::ser::{Serializer, Impossible};
|
||||||
/// # use serde::__private::ser::Error;
|
/// # use serde::__private::doc::Error;
|
||||||
/// #
|
/// #
|
||||||
/// # struct MySerializer;
|
/// # struct MySerializer;
|
||||||
/// #
|
/// #
|
||||||
|
|||||||
@@ -711,7 +711,7 @@ pub trait Serializer: Sized {
|
|||||||
///
|
///
|
||||||
/// ```edition2018
|
/// ```edition2018
|
||||||
/// # use serde::ser::{Serializer, SerializeSeq};
|
/// # use serde::ser::{Serializer, SerializeSeq};
|
||||||
/// # use serde::__private::ser::Error;
|
/// # use serde::__private::doc::Error;
|
||||||
/// #
|
/// #
|
||||||
/// # struct MySerializer;
|
/// # struct MySerializer;
|
||||||
/// #
|
/// #
|
||||||
|
|||||||
Reference in New Issue
Block a user