#[non_exhaustive]pub enum SerdeError {
#[non_exhaustive] TypeMismatch {
message: String,
},
#[non_exhaustive] MissingMember {
member_name: String,
},
#[non_exhaustive] UnknownMember {
member_name: String,
},
#[non_exhaustive] InvalidInput {
message: String,
},
#[non_exhaustive] UnsupportedOperation {
message: String,
},
#[non_exhaustive] WriteFailed {
message: String,
},
#[non_exhaustive] NumericCoercionOverflow {
target: String,
value: String,
},
#[non_exhaustive] NumericCoercionLossy {
target: String,
value: String,
},
#[non_exhaustive] BlobDecodeFailed {
message: String,
},
#[non_exhaustive] TimestampParseFailed {
message: String,
},
#[non_exhaustive] Custom {
message: String,
},
}Expand description
Error type for shape serialization and deserialization operations.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]TypeMismatch
The data did not match the expected type described by the schema.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]MissingMember
A required structure member was missing during deserialization.
Not currently emitted. The schema-serde deserializers use the
push/consumer pattern and defer required-member enforcement to the
generated builder’s build(). This variant is reserved for
deserializers that choose to enforce member presence during the read.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]UnknownMember
An unknown member was encountered during deserialization.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]InvalidInput
The input data was malformed or invalid for the format.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]UnsupportedOperation
The operation is not supported by this serializer or deserializer.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]WriteFailed
An error occurred while writing output during serialization.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]NumericCoercionOverflow
A numeric coercion overflowed the target type’s representable range.
Emitted by the narrow numeric reads on
ShapeDeserializer
(read_byte, read_short, read_integer, read_long) when the
source value is outside the target’s [min, max] range.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]NumericCoercionLossy
A numeric coercion would lose precision in a context where precision loss is not acceptable.
Not currently emitted by the standard numeric reads. Per the SEP “Number coercion” rules, precision loss is silently ignored on the standard coercion path. This variant is reserved for callers (e.g. strict deserializers, customer code using a custom accessor) that choose to enforce lossless coercion.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]BlobDecodeFailed
Failed to decode a blob from its wire-format representation — for example, invalid base64 in a JSON payload.
Not currently emitted. In-tree codecs surface blob-decode
failures as InvalidInput. This variant is
reserved for codecs that want to distinguish blob-decode failures as a
separate category.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]TimestampParseFailed
Failed to parse a timestamp from its wire-format representation — for example, a malformed RFC-3339 string or an out-of-range epoch-seconds value.
Not currently emitted. In-tree codecs surface timestamp-parse
failures as InvalidInput. This variant is
reserved for codecs that want to distinguish timestamp-parse failures
as a separate category.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]Custom
Catch-all for errors not covered by other variants.
Implementations§
Source§impl SerdeError
impl SerdeError
Sourcepub fn type_mismatch(message: impl Into<String>) -> Self
pub fn type_mismatch(message: impl Into<String>) -> Self
Creates a TypeMismatch error describing what was expected
versus what was found.
Sourcepub fn missing_member(member_name: impl Into<String>) -> Self
pub fn missing_member(member_name: impl Into<String>) -> Self
Creates a MissingMember error for the given member name.
Sourcepub fn unknown_member(member_name: impl Into<String>) -> Self
pub fn unknown_member(member_name: impl Into<String>) -> Self
Creates an UnknownMember error for the given member name.
Sourcepub fn invalid_input(message: impl Into<String>) -> Self
pub fn invalid_input(message: impl Into<String>) -> Self
Creates an InvalidInput error with the given message.
Sourcepub fn unsupported(message: impl Into<String>) -> Self
pub fn unsupported(message: impl Into<String>) -> Self
Creates an UnsupportedOperation error with the given message.
Sourcepub fn write_failed(message: impl Into<String>) -> Self
pub fn write_failed(message: impl Into<String>) -> Self
Creates a WriteFailed error with the given message.
Sourcepub fn numeric_coercion_overflow(
target: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn numeric_coercion_overflow( target: impl Into<String>, value: impl Into<String>, ) -> Self
Creates a NumericCoercionOverflow error for a value that is
outside the representable range of target (e.g. "byte").
Sourcepub fn numeric_coercion_lossy(
target: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn numeric_coercion_lossy( target: impl Into<String>, value: impl Into<String>, ) -> Self
Creates a NumericCoercionLossy error for a value that cannot
be coerced to target without losing precision.
Sourcepub fn blob_decode_failed(message: impl Into<String>) -> Self
pub fn blob_decode_failed(message: impl Into<String>) -> Self
Creates a BlobDecodeFailed error with the given message.
Sourcepub fn timestamp_parse_failed(message: impl Into<String>) -> Self
pub fn timestamp_parse_failed(message: impl Into<String>) -> Self
Creates a TimestampParseFailed error with the given message.
Trait Implementations§
Source§impl Debug for SerdeError
impl Debug for SerdeError
Source§impl Display for SerdeError
impl Display for SerdeError
Source§impl Error for SerdeError
impl Error for SerdeError
1.30.0 · 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()
Source§impl From<DocumentError> for SerdeError
Lift a DocumentError coming out
of the format-aware coercion accessors on
DiscriminatedDocument
and the DocumentSettings
hooks they dispatch through, into the schema crate’s broader
SerdeError.
impl From<DocumentError> for SerdeError
Lift a DocumentError coming out
of the format-aware coercion accessors on
DiscriminatedDocument
and the DocumentSettings
hooks they dispatch through, into the schema crate’s broader
SerdeError.
The variant shapes line up one-to-one — DocumentError is a
strict subset (Document-shaped failures only); SerdeError adds
shape-serde concerns like missing/unknown members and write
failures that are out of scope for the types crate.
Auto Trait Implementations§
impl Freeze for SerdeError
impl RefUnwindSafe for SerdeError
impl Send for SerdeError
impl Sync for SerdeError
impl Unpin for SerdeError
impl UnsafeUnpin for SerdeError
impl UnwindSafe for SerdeError
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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