serialize: fix fallout
This commit is contained in:
parent
4bfaa93978
commit
6fc92578fe
1 changed files with 25 additions and 0 deletions
|
@ -1123,12 +1123,25 @@ impl Json {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE(stage0): remove impl after a snapshot
|
||||||
|
#[cfg(stage0)]
|
||||||
impl<'a> ops::Index<&'a str, Json> for Json {
|
impl<'a> ops::Index<&'a str, Json> for Json {
|
||||||
fn index(&self, idx: & &str) -> &Json {
|
fn index(&self, idx: & &str) -> &Json {
|
||||||
self.find(*idx).unwrap()
|
self.find(*idx).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||||
|
impl<'a> ops::Index<&'a str> for Json {
|
||||||
|
type Output = Json;
|
||||||
|
|
||||||
|
fn index(&self, idx: & &str) -> &Json {
|
||||||
|
self.find(*idx).unwrap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE(stage0): remove impl after a snapshot
|
||||||
|
#[cfg(stage0)]
|
||||||
impl ops::Index<uint, Json> for Json {
|
impl ops::Index<uint, Json> for Json {
|
||||||
fn index<'a>(&'a self, idx: &uint) -> &'a Json {
|
fn index<'a>(&'a self, idx: &uint) -> &'a Json {
|
||||||
match self {
|
match self {
|
||||||
|
@ -1138,6 +1151,18 @@ impl ops::Index<uint, Json> for Json {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||||
|
impl ops::Index<uint> for Json {
|
||||||
|
type Output = Json;
|
||||||
|
|
||||||
|
fn index<'a>(&'a self, idx: &uint) -> &'a Json {
|
||||||
|
match self {
|
||||||
|
&Json::Array(ref v) => v.index(idx),
|
||||||
|
_ => panic!("can only index Json with uint if it is an array")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The output of the streaming parser.
|
/// The output of the streaming parser.
|
||||||
#[deriving(PartialEq, Clone, Show)]
|
#[deriving(PartialEq, Clone, Show)]
|
||||||
pub enum JsonEvent {
|
pub enum JsonEvent {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue