Enum async_proto::ErrorContext

source ·
pub enum ErrorContext {
Show 15 variants Custom(String), BuiltIn { for_type: &'static str, }, WebSocket { source: Box<Self>, }, WebSocketSink, WebSocketStream, DefaultImpl, Derived { for_type: &'static str, }, EnumDiscrim { source: Box<Self>, }, UnnamedField { idx: usize, source: Box<Self>, }, NamedField { name: &'static str, source: Box<Self>, }, FromStr, AsString { source: Box<Self>, }, TryInto, Via { source: Box<Self>, }, Bitflags { source: Box<Self>, },
}
Expand description

Provides additional information about the origin of an error.

Variants§

§

Custom(String)

An error context you can use when manually implementing Protocol.

§

BuiltIn

The error was produced by a Protocol implementation defined in the async-proto crate.

Fields

§for_type: &'static str

The name of the type whose Protocol implementation produced the error.

Typically does not include type parameters.

§

WebSocket

The error occurred while reading/writing a WebSocket message.

Fields

§source: Box<Self>

The context of the error returned from the message’s Protocol implementation.

§

WebSocketSink

The error was produced by a sink returned from async_proto::websocket.

§

WebSocketStream

The error was produced by a stream returned from async_proto::websocket.

§

DefaultImpl

The error was produced by the default implementation of a Protocol trait method.

§

Derived

The error was produced by an automatically derived Protocol implementation.

Fields

§for_type: &'static str

The name of the type whose Protocol implementation produced the error.

§

EnumDiscrim

The error occurred while reading/writing the discriminant of an enum.

Fields

§source: Box<Self>

The context of the error returned from the discriminant type’s Protocol implementation.

§

UnnamedField

The error occurred while reading/writing a field of a tuple, tuple struct, or tuple enum variant.

Fields

§idx: usize

The position of the field, starting at 0.

§source: Box<Self>

The context of the error returned from the field’s Protocol implementation.

§

NamedField

The error occurred while reading/writing a field of a struct or struct enum variant.

Fields

§name: &'static str

The name of the field.

§source: Box<Self>

The context of the error returned from the field’s Protocol implementation.

§

FromStr

The error occurred in the FromStr implementation of a type whose Protocol implementation was derived with #[async_proto(as_string)].

§

AsString

The error occurred while reading/writing a string representing a type whose Protocol implementation was derived with #[async_proto(as_string)].

Fields

§source: Box<Self>

The context of the error returned from String’s Protocol implementation.

§

TryInto

The error occurred in the TryInto implementation for a type whose Protocol implementation was derived with #[async_proto(via = ...)].

§

Via

The error occurred while reading/writing a proxy type representing a type whose Protocol implementation was derived with #[async_proto(via ...)].

Fields

§source: Box<Self>

The context of the error returned from the proxy type’s Protocol implementation.

§

Bitflags

The error was produced by the async_proto::bitflags macro.

Fields

§source: Box<Self>

The context of the error returned from the bits type’s Protocol implementation.

Trait Implementations§

source§

impl Debug for ErrorContext

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V