Rename visit_simple to visit_newtype

This commit is contained in:
Erick Tryzelaar
2015-07-29 15:41:37 -07:00
parent fefc010deb
commit 6715fb6652
6 changed files with 17 additions and 15 deletions
+2 -2
View File
@@ -924,11 +924,11 @@ impl<T, E> Deserialize for Result<T, E> where T: Deserialize, E: Deserialize {
{
match try!(visitor.visit_variant()) {
Field::Ok => {
let value = try!(visitor.visit_simple());
let value = try!(visitor.visit_newtype());
Ok(Ok(value))
}
Field::Err => {
let value = try!(visitor.visit_simple());
let value = try!(visitor.visit_newtype());
Ok(Err(value))
}
}
+4 -4
View File
@@ -579,8 +579,8 @@ pub trait VariantVisitor {
Err(Error::syntax_error())
}
/// `visit_simple` is called when deserializing a variant with a single value.
fn visit_simple<T>(&mut self) -> Result<T, Self::Error>
/// `visit_newtype` is called when deserializing a variant with a single value.
fn visit_newtype<T>(&mut self) -> Result<T, Self::Error>
where T: Deserialize,
{
Err(Error::syntax_error())
@@ -618,10 +618,10 @@ impl<'a, T> VariantVisitor for &'a mut T where T: VariantVisitor {
(**self).visit_unit()
}
fn visit_simple<D>(&mut self) -> Result<D, T::Error>
fn visit_newtype<D>(&mut self) -> Result<D, T::Error>
where D: Deserialize,
{
(**self).visit_simple()
(**self).visit_newtype()
}
fn visit_tuple<V>(&mut self,