mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-11-04 08:31:07 +00:00
partially implement deserializing options
This commit is contained in:
1 parent
0765c4e7d2
commit
3ec4829d7c
1 file changed
+4
-1
@@ -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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user