pub enum RsonError {
SyntaxError {
message: String,
line: usize,
column: usize,
},
UnexpectedEof,
InvalidCharacter {
found: char,
expected: String,
position: usize,
},
InvalidNumber(String),
InvalidEscape(String),
InvalidUnicode(String),
InvalidIdentifier(String),
TypeMismatch {
expected: String,
found: String,
},
IndexOutOfBounds(usize),
KeyNotFound(String),
Custom(String),
}Expand description
Errors that can occur during RSON parsing and processing.
Variants§
SyntaxError
Syntax error in RSON input
UnexpectedEof
Unexpected end of input
InvalidCharacter
Invalid character in input
InvalidNumber(String)
Invalid number format
InvalidEscape(String)
Invalid string escape sequence
InvalidUnicode(String)
Invalid Unicode codepoint
InvalidIdentifier(String)
Invalid identifier
TypeMismatch
Type mismatch during conversion
IndexOutOfBounds(usize)
Index out of bounds
KeyNotFound(String)
Key not found
Custom(String)
Custom error message
Implementations§
Source§impl RsonError
impl RsonError
Sourcepub fn syntax_error<S>(message: S, line: usize, column: usize) -> RsonError
pub fn syntax_error<S>(message: S, line: usize, column: usize) -> RsonError
Create a new syntax error.
Sourcepub fn invalid_character<S>(
found: char,
expected: S,
position: usize,
) -> RsonError
pub fn invalid_character<S>( found: char, expected: S, position: usize, ) -> RsonError
Create a new invalid character error.
Sourcepub fn type_mismatch<S>(expected: S, found: S) -> RsonError
pub fn type_mismatch<S>(expected: S, found: S) -> RsonError
Create a new type mismatch error.
Trait Implementations§
Source§impl Error for RsonError
Available on crate feature std only.
impl Error for RsonError
Available on crate feature
std only.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 StructuralPartialEq for RsonError
Auto Trait Implementations§
impl Freeze for RsonError
impl RefUnwindSafe for RsonError
impl Send for RsonError
impl Sync for RsonError
impl Unpin for RsonError
impl UnsafeUnpin for RsonError
impl UnwindSafe for RsonError
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