Unignore Serializer::serialize_newtype_struct example

This commit is contained in:
David Tolnay 2017-04-07 10:02:11 -07:00
parent 753c711cd7
commit 43d49f54be
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -452,8 +452,18 @@ pub trait Serializer: Sized {
/// wrappers around the data they contain. A reasonable implementation would
/// be to forward to `value.serialize(self)`.
///
/// ```rust,ignore
/// serializer.serialize_newtype_struct("Millimeters", &self.0)
/// ```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)
/// }
/// }
/// ```
fn serialize_newtype_struct<T: ?Sized + Serialize>(self,
name: &'static str,