Unignore Serializer::serialize_struct_variant example

This commit is contained in:
David Tolnay
2017-04-07 10:35:42 -07:00
parent f2b230a0b8
commit b1cfa5aef5
+14 -1
View File
@@ -771,7 +771,18 @@ pub trait Serializer: Sized {
/// this variant within the enum, the `variant` is the name of the variant, /// this variant within the enum, the `variant` is the name of the variant,
/// and the `len` is the number of data fields that will be serialized. /// and the `len` is the number of data fields that will be serialized.
/// ///
/// ```rust,ignore /// ```rust
/// use serde::{Serialize, Serializer};
/// use serde::ser::SerializeStructVariant;
///
/// enum E {
/// S { r: u8, g: u8, b: u8 }
/// }
///
/// impl Serialize for E {
/// fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
/// where S: Serializer
/// {
/// match *self { /// match *self {
/// E::S { ref r, ref g, ref b } => { /// E::S { ref r, ref g, ref b } => {
/// let mut sv = serializer.serialize_struct_variant("E", 0, "S", 3)?; /// let mut sv = serializer.serialize_struct_variant("E", 0, "S", 3)?;
@@ -781,6 +792,8 @@ pub trait Serializer: Sized {
/// sv.end() /// sv.end()
/// } /// }
/// } /// }
/// }
/// }
/// ``` /// ```
fn serialize_struct_variant(self, fn serialize_struct_variant(self,
name: &'static str, name: &'static str,