Enum ruma_signatures::JsonError
source · [−]#[non_exhaustive]
pub enum JsonError {
NotOfType {
target: String,
of_type: JsonType,
},
NotMultiplesOfType {
target: String,
of_type: JsonType,
},
JsonFieldMissingFromObject(String),
JsonKeyMissing {
for_target: String,
type_of: String,
with_key: String,
},
Serde(Error),
}
Expand description
All errors related to JSON validation/parsing.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
NotOfType
Fields
target: String
An arbitrary “target” that doesn’t have the required type.
of_type: JsonType
The JSON type the target was expected to be.
Signals that target
is not of type of_type
(JsonType
).
NotMultiplesOfType
Fields
target: String
An arbitrary “target” where each or one of it’s elements doesn’t have the required type.
of_type: JsonType
The JSON type the element was expected to be.
Like JsonError::NotOfType
, only called when the target
is a multiple;
array, set, etc.
JsonFieldMissingFromObject(String)
Signals that a specific field is missing from a JSON object.
JsonKeyMissing
Fields
for_target: String
The target from which the key is missing.
type_of: String
The kind of thing the key indicates.
with_key: String
The key that is missing.
Signals a key missing from a JSON object.
Note that this is different from JsonError::JsonFieldMissingFromObject
,
this error talks about an expected identifying key ("ed25519:abcd"
)
missing from a target, where the key has a specific “type”/name.
Serde(Error)
A more generic JSON error from serde_json
.
Trait Implementations
sourceimpl Error for JsonError
impl Error for JsonError
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations
impl !RefUnwindSafe for JsonError
impl Send for JsonError
impl Sync for JsonError
impl Unpin for JsonError
impl !UnwindSafe for JsonError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more