Struct Reason

pub struct Reason(/* private field */);

HTTP/2 error codes.

Error codes are used in RST_STREAM and GOAWAY frames to convey the reasons for the stream or connection error. For example, SendStream::send_reset takes a Reason argument. Also, the Error type may contain a Reason.

Error codes share a common code space. Some error codes apply only to streams, others apply only to connections, and others may apply to either. See [RFC 7540] for more information.

See Error Codes in the spec.

Implementations

impl Reason

const NO_ERROR: Reason = _;

The associated condition is not a result of an error.

For example, a GOAWAY might include this code to indicate graceful shutdown of a connection.

const PROTOCOL_ERROR: Reason = _;

The endpoint detected an unspecific protocol error.

This error is for use when a more specific error code is not available.

const INTERNAL_ERROR: Reason = _;

The endpoint encountered an unexpected internal error.

const FLOW_CONTROL_ERROR: Reason = _;

The endpoint detected that its peer violated the flow-control protocol.

const SETTINGS_TIMEOUT: Reason = _;

The endpoint sent a SETTINGS frame but did not receive a response in a timely manner.

const STREAM_CLOSED: Reason = _;

The endpoint received a frame after a stream was half-closed.

const FRAME_SIZE_ERROR: Reason = _;

The endpoint received a frame with an invalid size.

const REFUSED_STREAM: Reason = _;

The endpoint refused the stream prior to performing any application processing.

const CANCEL: Reason = _;

Used by the endpoint to indicate that the stream is no longer needed.

const COMPRESSION_ERROR: Reason = _;

The endpoint is unable to maintain the header compression context for the connection.

const CONNECT_ERROR: Reason = _;

The connection established in response to a CONNECT request was reset or abnormally closed.

const ENHANCE_YOUR_CALM: Reason = _;

The endpoint detected that its peer is exhibiting a behavior that might be generating excessive load.

const INADEQUATE_SECURITY: Reason = _;

The underlying transport has properties that do not meet minimum security requirements.

const HTTP_1_1_REQUIRED: Reason = _;

The endpoint requires that HTTP/1.1 be used instead of HTTP/2.

fn description(&self) -> &str

Get a string description of the error code.

Trait Implementations

impl Clone for Reason

fn clone(&self) -> Self

impl Copy for Reason

impl Debug for Reason

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

impl Display for Reason

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

impl Eq for Reason

impl From<u32> for Reason

fn from(src: u32) -> Reason

impl PartialEq for Reason

fn eq(&self, other: &Self) -> bool

impl StructuralPartialEq for Reason

Auto Trait Implementations

impl Freeze for Reason

impl RefUnwindSafe for Reason

impl Send for Reason

impl Sync for Reason

impl Unpin for Reason

impl UnsafeUnpin for Reason

impl UnwindSafe for Reason

Blanket Implementations

impl<Q, K> Equivalent<K> for Reason where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

fn equivalent(&self, key: &K) -> bool

impl<Q, K> Equivalent<K> for Reason where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

fn equivalent(&self, key: &K) -> bool

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> CloneToUninit for Reason where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Reason

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Reason

impl<T> ToOwned for Reason where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> ToString for Reason where T: Display + ?Sized,

fn to_string(&self) -> String

impl<T> WithSubscriber for Reason

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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