Skip to main content

BoxError

Type Alias BoxError 

Source
pub type BoxError = Box<dyn Error + Send + Sync>;
Expand description

The error type carried by every streaming response body in this crate (ResponseStream, OutboundStreamingResponse::body, the idle module’s wrappers). Deliberately not hyper::Error: that type has no public constructor anywhere in the hyper crate (every one of them is pub(super)), so nothing built on top of it can ever report its own failure (an idle timeout, a future size cap, a shutdown-drain cutoff) — only forward an error hyper already produced from a real connection. A boxed std::error::Error is strictly more permissive than what hyper’s own serve_connection requires of a response body’s error type (Into<Box<dyn StdError + Send + Sync>>), so this costs nothing on the send side while unblocking every synthetic error this crate needs to produce. hyper::Error itself satisfies Into<BoxError> via the standard library’s blanket From<E: Error + Send + Sync> for Box<dyn Error + Send + Sync>, so forwarding a real hyper error through is a no-op conversion, not a loss of information.

Aliased Type§

pub struct BoxError(/* private fields */);