Allow VariantVisitor::visit_newtype to default to calling visit_tuple
This commit is contained in:
parent
2c58a9c11d
commit
94f3dd25d8
@ -596,11 +596,14 @@ pub trait VariantVisitor {
|
|||||||
Err(Error::syntax_error())
|
Err(Error::syntax_error())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `visit_newtype` is called when deserializing a variant with a single value.
|
/// `visit_newtype` is called when deserializing a variant with a single value. By default this
|
||||||
|
/// uses the `visit_tuple` method to deserialize the value.
|
||||||
|
#[inline]
|
||||||
fn visit_newtype<T>(&mut self) -> Result<T, Self::Error>
|
fn visit_newtype<T>(&mut self) -> Result<T, Self::Error>
|
||||||
where T: Deserialize,
|
where T: Deserialize,
|
||||||
{
|
{
|
||||||
Err(Error::syntax_error())
|
let (value,) = try!(self.visit_tuple(1, impls::TupleVisitor1::new()));
|
||||||
|
Ok(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `visit_tuple` is called when deserializing a tuple-like variant.
|
/// `visit_tuple` is called when deserializing a tuple-like variant.
|
||||||
|
Loading…
Reference in New Issue
Block a user