pub struct TransportFailure<E> { /* private fields */ }Expand description
Payload-redacting transport failure with an explicit delivery phase and optional already-observed final status.
Unknown send state must use Self::unknown, which conservatively maps to
DeliveryPhase::PossiblySent.
Implementations§
Source§impl<E> TransportFailure<E>
impl<E> TransportFailure<E>
Sourcepub const fn not_sent(error: E) -> Self
pub const fn not_sent(error: E) -> Self
Records a failure proven to have happened before request delivery.
Sourcepub const fn possibly_sent(error: E) -> Self
pub const fn possibly_sent(error: E) -> Self
Records a failure after request delivery may have begun.
Sourcepub const fn response_started(error: E) -> Self
pub const fn response_started(error: E) -> Self
Records a failure after any response head was observed.
Sourcepub const fn response_started_with_status(status: StatusCode, error: E) -> Self
pub const fn response_started_with_status(status: StatusCode, error: E) -> Self
Records a failure after the supplied final response status was observed.
Sourcepub const fn unknown(error: E) -> Self
pub const fn unknown(error: E) -> Self
Conservatively records an error whose delivery state is unknown.
Sourcepub const fn phase(&self) -> DeliveryPhase
pub const fn phase(&self) -> DeliveryPhase
Returns the conservative delivery phase.
Sourcepub const fn observed_status(&self) -> Option<StatusCode>
pub const fn observed_status(&self) -> Option<StatusCode>
Returns a final status observed before response processing failed.
Sourcepub const fn with_observed_status(self, status: StatusCode) -> Self
pub const fn with_observed_status(self, status: StatusCode) -> Self
Preserves this failure while attaching a subsequently known final status.
Sourcepub fn into_error(self) -> E
pub fn into_error(self) -> E
Consumes the failure and returns its adapter error.
Sourcepub fn map<F>(self, transform: impl FnOnce(E) -> F) -> TransportFailure<F>
pub fn map<F>(self, transform: impl FnOnce(E) -> F) -> TransportFailure<F>
Transforms the payload-free adapter error while preserving delivery state.
Trait Implementations§
Source§impl<E: Clone> Clone for TransportFailure<E>
impl<E: Clone> Clone for TransportFailure<E>
Source§fn clone(&self) -> TransportFailure<E>
fn clone(&self) -> TransportFailure<E>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<E: Copy> Copy for TransportFailure<E>
Source§impl<E> Debug for TransportFailure<E>
impl<E> Debug for TransportFailure<E>
Source§impl<E> DeliveryClassified for TransportFailure<E>
impl<E> DeliveryClassified for TransportFailure<E>
Source§fn delivery_phase(&self) -> DeliveryPhase
fn delivery_phase(&self) -> DeliveryPhase
Source§fn observed_status(&self) -> Option<StatusCode>
fn observed_status(&self) -> Option<StatusCode>
Source§impl<E> Display for TransportFailure<E>
impl<E> Display for TransportFailure<E>
impl<E: Eq> Eq for TransportFailure<E>
Source§impl<E> Error for TransportFailure<E>
impl<E> Error for TransportFailure<E>
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()