diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-03 10:40:26 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-03 16:30:49 -0500 |
| commit | 6fc92578fee125615b4357bdd3142a8f07b20b54 (patch) | |
| tree | 28abdb35190578bad82b1397254911c34029255c /src/libserialize | |
| parent | 4bfaa9397857b5b49657e3596e33800dbf35ade4 (diff) | |
| download | rust-6fc92578fee125615b4357bdd3142a8f07b20b54.tar.gz rust-6fc92578fee125615b4357bdd3142a8f07b20b54.zip | |
serialize: fix fallout
Diffstat (limited to 'src/libserialize')
| -rw-r--r-- | src/libserialize/json.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 83badb0c57c..71117c7fe12 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -1123,12 +1123,25 @@ impl Json { } } +// NOTE(stage0): remove impl after a snapshot +#[cfg(stage0)] impl<'a> ops::Index<&'a str, Json> for Json { fn index(&self, idx: & &str) -> &Json { 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 { fn index<'a>(&'a self, idx: &uint) -> &'a Json { 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. #[deriving(PartialEq, Clone, Show)] pub enum JsonEvent { |
