Unignore Serializer::serialize_tuple_struct example

This commit is contained in:
David Tolnay 2017-04-07 10:26:00 -07:00
parent 8d130123d9
commit fccb395168
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -614,12 +614,23 @@ pub trait Serializer: Sized {
/// The `name` is the name of the tuple struct and the `len` is the number
/// of data fields that will be serialized.
///
/// ```rust,ignore
/// let mut ts = serializer.serialize_tuple_struct("Rgb", 3)?;
/// ts.serialize_field(&self.0)?;
/// ts.serialize_field(&self.1)?;
/// ts.serialize_field(&self.2)?;
/// ts.end()
/// ```rust
/// use serde::{Serialize, Serializer};
/// use serde::ser::SerializeTupleStruct;
///
/// struct Rgb(u8, u8, u8);
///
/// impl Serialize for Rgb {
/// fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
/// where S: Serializer
/// {
/// let mut ts = serializer.serialize_tuple_struct("Rgb", 3)?;
/// ts.serialize_field(&self.0)?;
/// ts.serialize_field(&self.1)?;
/// ts.serialize_field(&self.2)?;
/// ts.end()
/// }
/// }
/// ```
fn serialize_tuple_struct(self,
name: &'static str,