#[non_exhaustive]pub enum Error {
Parse(Error),
Length,
TrailingData,
UnfinishedArray,
Custom(String),
Redis(Vec<u8>),
}
Expand description
Errors that can occur while deserializing RESP data.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Parse(Error)
There was an error during parsing (such as a \r without a \n).
Length
The length of an array or bulk string was out of bounds. It might have been negative, or exceeded the 512MB limit for bulk strings.
TrailingData
There was leftover data in the input after the deserialize operation.
This is only returned by from_str
and similar functions; the
Deserializer
itself will normally just leave that data untouched,
to facilitate response pipelining.
UnfinishedArray
The Deserialize
type successfully deserialized from a Redis array,
but didn’t consume the whole thing.
Custom(String)
There was an error from the Deserialize
type
Redis(Vec<u8>)
We successfully deserialized a Redis Error value (with the -
tag)
See the module docs on Result
deserialization for how to avoid this
error.
Trait Implementations§
source§impl Error for Error
impl Error for Error
source§fn custom<T>(msg: T) -> Selfwhere
T: Display,
fn custom<T>(msg: T) -> Selfwhere T: Display,
source§fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize
receives a type different from what it was
expecting. Read moresource§fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize
receives a value of the right type but that
is wrong for some other reason. Read moresource§fn invalid_length(len: usize, exp: &dyn Expected) -> Self
fn invalid_length(len: usize, exp: &dyn Expected) -> Self
source§fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
Deserialize
enum type received a variant with an
unrecognized name.source§fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
Deserialize
struct type received a field with an
unrecognized name.source§fn missing_field(field: &'static str) -> Self
fn missing_field(field: &'static str) -> Self
Deserialize
struct type expected to receive a required
field with a particular name but that field was not present in the
input.source§fn duplicate_field(field: &'static str) -> Self
fn duplicate_field(field: &'static str) -> Self
Deserialize
struct type received more than one of the
same field.