pub enum ParseError {
Empty,
BadFormat(String),
MissingField(&'static str),
ExtraField(String),
Type(&'static str),
TypeField {
expected: &'static str,
field: Option<&'static str>,
},
InvalidUtf8,
InvalidBase64(String),
OutOfRange(&'static str),
Nested(Box<ParseError>),
}Expand description
Errors produced by the canonical text / JSON parsers.
Variants§
Empty
Input was empty where a non-empty value is required.
BadFormat(String)
Input had the wrong shape (free-form description).
MissingField(&'static str)
JSON object was missing a required field.
ExtraField(String)
JSON object carried an unexpected field name.
Type(&'static str)
JSON value (or field value) did not have the expected JSON type.
Retained for sites that do not yet know which field they were reading;
new code should prefer ParseError::TypeField.
TypeField
JSON value did not have the expected JSON type, with the field name that produced the failure when applicable.
InvalidUtf8
Bytes were not valid UTF-8 when text was required.
InvalidBase64(String)
Base64 payload could not be decoded.
OutOfRange(&'static str)
Number was out of the supported range.
Nested(Box<ParseError>)
Embedded sub-value failed to parse.
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
impl Eq for ParseError
Source§impl Error for ParseError
impl Error for ParseError
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()
Source§impl From<ParseError> for RenderError
impl From<ParseError> for RenderError
Source§fn from(value: ParseError) -> RenderError
fn from(value: ParseError) -> RenderError
Converts to this type from the input type.
Source§impl PartialEq for ParseError
impl PartialEq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnsafeUnpin for ParseError
impl UnwindSafe for ParseError
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