Unignore VariantVisitor::visit_struct example
This commit is contained in:
parent
d2d4892873
commit
f12a951f22
@ -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],
|
||||
|
Loading…
Reference in New Issue
Block a user