mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-03 07:45:38 +00:00
Unignore Serializer::serialize_newtype_struct example
This commit is contained in:
parent
753c711cd7
commit
43d49f54be
@ -452,8 +452,18 @@ pub trait Serializer: Sized {
|
|||||||
/// wrappers around the data they contain. A reasonable implementation would
|
/// wrappers around the data they contain. A reasonable implementation would
|
||||||
/// be to forward to `value.serialize(self)`.
|
/// be to forward to `value.serialize(self)`.
|
||||||
///
|
///
|
||||||
/// ```rust,ignore
|
/// ```rust
|
||||||
|
/// # use serde::{Serialize, Serializer};
|
||||||
|
/// #
|
||||||
|
/// struct Millimeters(u8);
|
||||||
|
///
|
||||||
|
/// impl Serialize for Millimeters {
|
||||||
|
/// fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
/// where S: Serializer
|
||||||
|
/// {
|
||||||
/// serializer.serialize_newtype_struct("Millimeters", &self.0)
|
/// serializer.serialize_newtype_struct("Millimeters", &self.0)
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
fn serialize_newtype_struct<T: ?Sized + Serialize>(self,
|
fn serialize_newtype_struct<T: ?Sized + Serialize>(self,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user