Update to rust HEAD

This commit is contained in:
Erick Tryzelaar 2014-08-02 09:25:44 -07:00
parent 5bfc73e36b
commit 4fc124de9b
4 changed files with 28 additions and 4 deletions

View File

@ -41,6 +41,7 @@ impl Deserializable for Animal {
enum Error {
EndOfStream,
SyntaxError,
OtherError(String),
}
//////////////////////////////////////////////////////////////////////////////
@ -48,7 +49,7 @@ enum Error {
mod decoder {
use serialize::Decoder;
use super::{Animal, Dog, Frog, Error, SyntaxError};
use super::{Animal, Dog, Frog, Error, SyntaxError, OtherError};
enum State {
AnimalState(Animal),
@ -73,6 +74,10 @@ mod decoder {
}
impl Decoder<Error> for AnimalDecoder {
fn error(&mut self, msg: &str) -> Error {
OtherError(msg.to_string())
}
// Primitive types:
fn read_nil(&mut self) -> Result<(), Error> { Err(SyntaxError) }
fn read_uint(&mut self) -> Result<uint, Error> { Err(SyntaxError) }

View File

@ -12,6 +12,7 @@ use de::{Deserializer, Deserializable};
enum Error {
EndOfStream,
SyntaxError,
OtherError(String),
}
//////////////////////////////////////////////////////////////////////////////
@ -21,7 +22,7 @@ mod decoder {
use std::collections::hashmap::MoveEntries;
use serialize;
use super::{Error, EndOfStream, SyntaxError};
use super::{Error, EndOfStream, SyntaxError, OtherError};
enum Value {
StringValue(String),
@ -46,6 +47,10 @@ mod decoder {
}
impl serialize::Decoder<Error> for IntDecoder {
fn error(&mut self, msg: &str) -> Error {
OtherError(msg.to_string())
}
// Primitive types:
fn read_nil(&mut self) -> Result<(), Error> { Err(SyntaxError) }
fn read_uint(&mut self) -> Result<uint, Error> { Err(SyntaxError) }

View File

@ -120,13 +120,14 @@ impl Deserializable for Outer {
enum Error {
EndOfStream,
SyntaxError,
OtherError(String),
}
mod decoder {
use std::collections::HashMap;
use serialize::Decoder;
use super::{Outer, Inner, Error, SyntaxError};
use super::{Outer, Inner, Error, SyntaxError, OtherError};
#[deriving(Show)]
enum State {
@ -157,6 +158,10 @@ mod decoder {
}
impl Decoder<Error> for OuterDecoder {
fn error(&mut self, msg: &str) -> Error {
OtherError(msg.to_string())
}
// Primitive types:
#[inline]
fn read_nil(&mut self) -> Result<(), Error> {

View File

@ -11,6 +11,7 @@ use de::{Deserializer, Deserializable};
enum Error {
EndOfStream,
SyntaxError,
OtherError(String),
}
//////////////////////////////////////////////////////////////////////////////
@ -19,7 +20,7 @@ mod decoder {
use std::vec;
use serialize;
use super::{Error, EndOfStream, SyntaxError};
use super::{Error, EndOfStream, SyntaxError, OtherError};
pub struct IntDecoder {
len: uint,
@ -37,6 +38,10 @@ mod decoder {
}
impl serialize::Decoder<Error> for IntDecoder {
fn error(&mut self, msg: &str) -> Error {
OtherError(msg.to_string())
}
// Primitive types:
fn read_nil(&mut self) -> Result<(), Error> { Err(SyntaxError) }
fn read_uint(&mut self) -> Result<uint, Error> { Err(SyntaxError) }
@ -138,6 +143,10 @@ mod decoder {
}
impl serialize::Decoder<Error> for U8Decoder {
fn error(&mut self, msg: &str) -> Error {
OtherError(msg.to_string())
}
// Primitive types:
fn read_nil(&mut self) -> Result<(), Error> { Err(SyntaxError) }
fn read_uint(&mut self) -> Result<uint, Error> { Err(SyntaxError) }