mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-24 19:18:00 +00:00
wip: remove error fns from de
This commit is contained in:
@@ -387,14 +387,6 @@ impl<Iter: Iterator<u8>> Deserializer<Error> for Parser<Iter> {
|
||||
>(&mut self, visitor: &mut V) -> Result<R, Error> {
|
||||
self.parse_value(visitor)
|
||||
}
|
||||
|
||||
fn syntax_error(&mut self) -> Error {
|
||||
Error::SyntaxError(ErrorCode::ExpectedSomeValue, self.line, self.col)
|
||||
}
|
||||
|
||||
fn end_of_stream_error(&mut self) -> Error {
|
||||
Error::SyntaxError(ErrorCode::EOFWhileParsingValue, self.line, self.col)
|
||||
}
|
||||
}
|
||||
|
||||
struct SeqVisitor {
|
||||
|
||||
@@ -2,6 +2,8 @@ use std::error;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
|
||||
use de;
|
||||
|
||||
/// The errors that can arise while parsing a JSON stream.
|
||||
#[deriving(Clone, PartialEq)]
|
||||
pub enum ErrorCode {
|
||||
@@ -124,3 +126,13 @@ impl error::FromError<io::IoError> for Error {
|
||||
Error::IoError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl de::Error for Error {
|
||||
fn syntax_error() -> Error {
|
||||
Error::SyntaxError(ErrorCode::ExpectedSomeValue, 0, 0)
|
||||
}
|
||||
|
||||
fn end_of_stream_error() -> Error {
|
||||
Error::SyntaxError(ErrorCode::EOFWhileParsingValue, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user