pub enum DecodeError {
UnknownKind(String),
Malformed {
codec: &'static str,
message: String,
cause: Option<BoxedCause>,
},
WrongEncoding(String),
BadSchema {
message: String,
cause: Option<BoxedCause>,
},
Encode {
message: String,
cause: Option<BoxedCause>,
},
}decode and schema only.Expand description
A decode/encode failure.
The three variants that wrap a codec’s own error carry it boxed rather
than stringified (#317). Three codecs means three unrelated error types
(serde_json, ciborium, prost), so the box is what lets one variant
hold any of them; Display is unchanged, because it still prints the
inner error’s Display — what changes is that source() now reaches it.
Variants§
Implementations§
Source§impl DecodeError
impl DecodeError
Sourcepub fn malformed(codec: &'static str, cause: impl Into<BoxedCause>) -> Self
pub fn malformed(codec: &'static str, cause: impl Into<BoxedCause>) -> Self
A codec refused the bytes — its error is the cause.
Sourcepub fn malformed_here(codec: &'static str, message: impl Into<String>) -> Self
pub fn malformed_here(codec: &'static str, message: impl Into<String>) -> Self
This crate refused the bytes: there is no underlying error, and
source() says so rather than inventing one.
Sourcepub fn bad_schema(message: impl Into<String>) -> Self
pub fn bad_schema(message: impl Into<String>) -> Self
A schema entry this build cannot use, explained by this crate.
Sourcepub fn bad_schema_from(cause: impl Into<BoxedCause>) -> Self
pub fn bad_schema_from(cause: impl Into<BoxedCause>) -> Self
A schema entry a validator rejected — its error is the cause.
Sourcepub fn encode(cause: impl Into<BoxedCause>) -> Self
pub fn encode(cause: impl Into<BoxedCause>) -> Self
An encode failure from a codec.
Sourcepub fn encode_here(message: impl Into<String>) -> Self
pub fn encode_here(message: impl Into<String>) -> Self
An encode refusal this crate made itself.
Trait Implementations§
Source§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for DecodeError
impl !UnwindSafe for DecodeError
impl Freeze for DecodeError
impl Send for DecodeError
impl Sync for DecodeError
impl Unpin for DecodeError
impl UnsafeUnpin for DecodeError
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more