Add Error::length_mismatch, Error::type_mismatch, and de::Type

This improves error handling to match the needs of msgpack
This commit is contained in:
Erick Tryzelaar
2015-08-09 21:42:11 -07:00
parent 5dc356ddb0
commit 63561609a6
4 changed files with 92 additions and 40 deletions
+2 -2
View File
@@ -843,7 +843,7 @@ impl<'a> de::SeqVisitor for SeqDeserializer<'a> {
if self.len == 0 {
Ok(())
} else {
Err(de::Error::end_of_stream())
Err(de::Error::length_mismatch(self.len))
}
}
@@ -888,7 +888,7 @@ impl<'a> de::MapVisitor for MapDeserializer<'a> {
if self.len == 0 {
Ok(())
} else {
Err(de::Error::end_of_stream())
Err(de::Error::length_mismatch(self.len))
}
}