# Struct h2::Reason [−] [src]

    pub struct Reason(_);

HTTP/2.0 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` [src]

#### `pub const NO_ERROR: Reason` [src]

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.

#### `pub const PROTOCOL_ERROR: Reason` [src]

The endpoint detected an unspecific protocol error.

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

#### `pub const INTERNAL_ERROR: Reason` [src]

The endpoint encountered an unexpected internal error.

#### `pub const FLOW_CONTROL_ERROR: Reason` [src]

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

#### `pub const SETTINGS_TIMEOUT: Reason` [src]

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

#### `pub const STREAM_CLOSED: Reason` [src]

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

#### `pub const FRAME_SIZE_ERROR: Reason` [src]

The endpoint received a frame with an invalid size.

#### `pub const REFUSED_STREAM: Reason` [src]

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

#### `pub const CANCEL: Reason` [src]

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

#### `pub const COMPRESSION_ERROR: Reason` [src]

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

#### `pub const CONNECT_ERROR: Reason` [src]

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

#### `pub const ENHANCE_YOUR_CALM: Reason` [src]

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

#### `pub const INADEQUATE_SECURITY: Reason` [src]

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

#### `pub const HTTP_1_1_REQUIRED: Reason` [src]

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

#### `pub fn description(&self) -> &str` [src]

Get a string description of the error code.

## Trait Implementations

### `impl Clone for Reason` [src]

#### `fn clone(&self) -> Reason` [src]

Returns a copy of the value. Read more

#### `pub fn clone_from(&mut self, source: &Self)`1.0.0 [src]

Performs copy-assignment from `source`. Read more

### `impl Copy for Reason` [src]

### `impl Debug for Reason` [src]

#### `fn fmt(&self, f: &mut Formatter<'_>) -> Result` [src]

Formats the value using the given formatter. Read more

### `impl Display for Reason` [src]

#### `fn fmt(&self, fmt: &mut Formatter<'_>) -> Result` [src]

Formats the value using the given formatter. Read more

### `impl Eq for Reason` [src]

### `impl From<Reason> for Error` [src]

#### `fn from(src: Reason) -> Error` [src]

Performs the conversion.

### `impl From<u32> for Reason` [src]

#### `fn from(src: u32) -> Reason` [src]

Performs the conversion.

### `impl PartialEq<Reason> for Reason` [src]

#### `fn eq(&self, other: &Reason) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `fn ne(&self, other: &Reason) -> bool` [src]

This method tests for `!=`.

### `impl StructuralEq for Reason` [src]

### `impl StructuralPartialEq for Reason` [src]

## Auto Trait Implementations

### `impl RefUnwindSafe for Reason`

### `impl Send for Reason`

### `impl Sync for Reason`

### `impl Unpin for Reason`

### `impl UnwindSafe for Reason`

## Blanket Implementations

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,` [src]

#### `pub fn equivalent(&self, key: &K) -> bool` [src]

Compare self to `key` and return `true` if they are equal.

### `impl<T> From<T> for T` [src]

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T> Instrument for T` [src]

#### `pub fn instrument(self, span: Span) -> Instrumented<Self>` [src]

Instruments this type with the provided `Span`, returning an `Instrumented` wrapper. Read more

#### `pub fn in_current_span(self) -> Instrumented<Self>` [src]

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `impl<T> ToOwned for T where
T: Clone,` [src]

#### `type Owned = T`

The resulting type after obtaining ownership.

#### `pub fn to_owned(&self) -> T` [src]

Creates owned data from borrowed data, usually by cloning. Read more

#### `pub fn clone_into(&self, target: &mut T)` [src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into`)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

### `impl<T> ToString for T where
T: Display + ?Sized,` [src]

#### `pub default fn to_string(&self) -> String` [src]

Converts the given value to a `String`. Read more

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

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

The type returned in the event of a conversion error.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.