protocol

Type Alias RecvError

source
pub type RecvError = Error<Error>;

Aliased Type§

enum RecvError {
    Io(Error),
    Syntax(usize),
    Semantic(Option<usize>, String),
    RecursionLimitExceeded,
}

Variants§

§

Io(Error)

An error occurred while reading bytes

Contains the underlying error returned while reading.

§

Syntax(usize)

An error occurred while parsing bytes

Contains the offset into the stream where the syntax error occurred.

§

Semantic(Option<usize>, String)

An error occurred while processing a parsed value

Contains a description of the error that occurred and (optionally) the offset into the stream indicating the start of the item being processed when the error occurred.

§

RecursionLimitExceeded

The input caused serde to recurse too much

This error prevents a stack overflow.

Implementations

§

impl<T> Error<T>

pub fn semantic( offset: impl Into<Option<usize>>, msg: impl Into<String>, ) -> Error<T>

A helper method for composing a semantic error

Trait Implementations

§

impl<T> Debug for Error<T>
where T: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> Display for Error<T>
where T: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> Error for Error<T>
where T: Debug,

1.30.0 · source§

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

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
§

impl<T> Error for Error<T>
where T: Debug,

§

fn custom<U>(msg: U) -> Error<T>
where U: Display,

Raised when there is general error when deserializing a type. Read more
source§

fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a type different from what it was expecting. Read more
source§

fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a value of the right type but that is wrong for some other reason. Read more
source§

fn invalid_length(len: usize, exp: &dyn Expected) -> Self

Raised when deserializing a sequence or map and the input data contains too many or too few elements. Read more
source§

fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize enum type received a variant with an unrecognized name.
source§

fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize struct type received a field with an unrecognized name.
source§

fn missing_field(field: &'static str) -> Self

Raised when a 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

Raised when a Deserialize struct type received more than one of the same field.
§

impl<T> From<Error<T>> for Error<T>

§

fn from(value: Error<T>) -> Error<T>

Converts to this type from the input type.
§

impl<T> From<T> for Error<T>

§

fn from(value: T) -> Error<T>

Converts to this type from the input type.