change json::Deserializer to take a json enum

This allows the deserializer to be used on an already
parsed json object.
This commit is contained in:
Erick Tryzelaar 2012-11-17 17:38:58 -08:00 committed by Graydon Hoare
parent 2d4c217186
commit 77ef4e7176

View File

@ -702,14 +702,8 @@ pub struct Deserializer {
priv mut stack: ~[&Json],
}
pub fn Deserializer(rdr: io::Reader) -> Result<Deserializer, Error> {
match move from_reader(rdr) {
Ok(move json) => {
let des = Deserializer { json: move json, stack: ~[] };
Ok(move des)
}
Err(move e) => Err(e)
}
pub fn Deserializer(json: Json) -> Deserializer {
Deserializer { json: move json, stack: ~[] }
}
priv impl Deserializer {