Skip to main content

Reason

Enum Reason 

Source
pub enum Reason<U>
where U: Encoder + Decoder,
{ Service, Io(Option<Error>), Encoder(<U as Encoder>::Error), Decoder(<U as Decoder>::Error), KeepAlive, ReadTimeout, WriteTimeout, }
Expand description

Reason a dispatcher is stopping.

Carried by DispatchItem::Stop, rather than returned as the dispatcher’s error type. The dispatcher also reports the corresponding ntex_io::CloseReason to the transport. An already-recorded transport close reason is not overwritten.

A stop caused by I/O, codec, or timeout failure can still yield Ok(()) from the dispatcher if no service error is recorded. Inspect the stop event, or IoRef::close_reason after the dispatcher completes, when the application needs to distinguish those outcomes; see the crate-level docs.

Variants§

§

Service

A service readiness check or event call failed.

The service error is retained for the dispatcher’s result; this notification does not contain or clone it.

§

Io(Option<Error>)

The transport closed or failed.

None indicates closure without an underlying I/O error, including clean peer EOF. Some(error) contains a transport error or an io::ErrorKind::UnexpectedEof synthesized when peer EOF leaves undecodable bytes in the read buffer.

§

Encoder(<U as Encoder>::Error)

A service response could not be encoded.

Contains the error returned by Encoder::encode.

§

Decoder(<U as Decoder>::Error)

Incoming bytes could not be decoded.

Contains the error returned by Decoder::decode.

§

KeepAlive

The connection’s idle timeout expired.

Usually caused by the configured keep-alive timeout. An external ntex_io::IoRef::notify_timeout notification can also produce this reason when no service call is in flight, even if keep-alive is disabled.

§

ReadTimeout

Frame-read progress was insufficient or its cumulative budget expired.

Controlled by IoConfig::set_frame_read_rate. Completing a frame ends its read-rate tracking; subsequent idle time is governed by keep-alive instead.

§

WriteTimeout

Write backpressure stayed enabled for longer than the configured write timeout.

Small writes do not extend the deadline unless they release backpressure. Once pressure is released, the timeout ends even if some output remains buffered. See IoConfig::set_write_timeout.

Trait Implementations§

Source§

impl<U> Debug for Reason<U>
where U: Encoder + Decoder, <U as Encoder>::Error: Debug, <U as Decoder>::Error: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<U> !RefUnwindSafe for Reason<U>

§

impl<U> !UnwindSafe for Reason<U>

§

impl<U> Freeze for Reason<U>
where <U as Encoder>::Error: Freeze, <U as Decoder>::Error: Freeze,

§

impl<U> Send for Reason<U>
where <U as Encoder>::Error: Send, <U as Decoder>::Error: Send,

§

impl<U> Sync for Reason<U>
where <U as Encoder>::Error: Sync, <U as Decoder>::Error: Sync,

§

impl<U> Unpin for Reason<U>
where <U as Encoder>::Error: Unpin, <U as Decoder>::Error: Unpin,

§

impl<U> UnsafeUnpin for Reason<U>
where <U as Encoder>::Error: UnsafeUnpin, <U as Decoder>::Error: UnsafeUnpin,

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.
§

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

§

fn vzip(self) -> V