partially implement deserializing options

This commit is contained in:
Erick Tryzelaar 2014-05-19 09:47:16 -07:00
parent 0765c4e7d2
commit 3ec4829d7c

5
de.rs
View File

@ -179,7 +179,10 @@ pub trait Deserializer<E>: Iterator<Result<Token, E>> {
>(&mut self, token: Token) -> Result<Option<T>, E> {
match token {
Null => Ok(None),
_ => fail!(),
token => {
let value: T = try!(Deserializable::deserialize_token(self, token));
Ok(Some(value))
}
}
}