pub enum JsonError {
Empty,
InvalidChar(char, usize),
UnterminatedString,
EndedOnEscape,
UnknownEscapeSequence(char),
NonStringAsKey,
InvalidCodepoint,
InvalidNumber,
}
Expand description
An error that occured while parsing a json file
The reading functions work recursive, that means major errors might end up
in the wrong category, for example mismatched parantheses result in an
Empty
error:
assert_eq!(JsonObject::read("[[[]]"), Err(Empty));
Variants§
Empty
The input was empty (or only whitespace)
InvalidChar(char, usize)
At the given position the given character was read invalidly
UnterminatedString
A string with no closing quote
EndedOnEscape
The input ended on a backslash
UnknownEscapeSequence(char)
An unknown escape sequence was encountered
NonStringAsKey
A not string was used as key in an JsonObject::Obj
InvalidCodepoint
Per ‘\uXXXX’ was an invalid code point specified
InvalidNumber
A number that is invalid in json, but is a perfectly fine floating-point number.
Trait Implementations§
Source§impl Error for JsonError
impl Error for JsonError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
impl Copy for JsonError
impl Eq for JsonError
impl StructuralPartialEq for JsonError
Auto Trait Implementations§
impl Freeze for JsonError
impl RefUnwindSafe for JsonError
impl Send for JsonError
impl Sync for JsonError
impl Unpin for JsonError
impl UnwindSafe for JsonError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more