partially implement deserializing options
This commit is contained in:
parent
0765c4e7d2
commit
3ec4829d7c
5
de.rs
5
de.rs
@ -179,7 +179,10 @@ pub trait Deserializer<E>: Iterator<Result<Token, E>> {
|
|||||||
>(&mut self, token: Token) -> Result<Option<T>, E> {
|
>(&mut self, token: Token) -> Result<Option<T>, E> {
|
||||||
match token {
|
match token {
|
||||||
Null => Ok(None),
|
Null => Ok(None),
|
||||||
_ => fail!(),
|
token => {
|
||||||
|
let value: T = try!(Deserializable::deserialize_token(self, token));
|
||||||
|
Ok(Some(value))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user