Unignore VariantVisitor::visit_struct example

This commit is contained in:
David Tolnay 2017-04-06 16:28:24 -07:00
parent d2d4892873
commit f12a951f22
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -1605,16 +1605,36 @@ pub trait VariantVisitor<'de>: Sized {
/// If the data contains a different type of variant, the following
/// `invalid_type` error should be constructed:
///
/// ```rust,ignore
/// ```rust
/// # use serde::de::{self, value, DeserializeSeed, Visitor, VariantVisitor, Unexpected};
/// #
/// # struct X;
/// #
/// # impl<'de> VariantVisitor<'de> for X {
/// # type Error = value::Error;
/// #
/// # fn visit_unit(self) -> Result<(), Self::Error> {
/// # unimplemented!()
/// # }
/// #
/// # fn visit_newtype_seed<T>(self, _: T) -> Result<T::Value, Self::Error>
/// # where T: DeserializeSeed<'de>
/// # { unimplemented!() }
/// #
/// # fn visit_tuple<V>(self, _: usize, _: V) -> Result<V::Value, Self::Error>
/// # where V: Visitor<'de>
/// # { unimplemented!() }
/// #
/// fn visit_struct<V>(self,
/// _fields: &'static [&'static str],
/// _visitor: V) -> Result<V::Value, Self::Error>
/// where V: Visitor
/// where V: Visitor<'de>
/// {
/// // What the data actually contained; suppose it is a unit variant.
/// let unexp = Unexpected::UnitVariant;
/// Err(Error::invalid_type(unexp, &"struct variant"))
/// Err(de::Error::invalid_type(unexp, &"struct variant"))
/// }
/// # }
/// ```
fn visit_struct<V>(self,
fields: &'static [&'static str],