pub struct Error { /* private fields */ }Expand description
Clone is deliberate: reqwest’s opaque, unclonable error is a source of
constant complaints (reqwest#1053).
source must be Send + Sync — the one documented exception to the
crate invariant “no declared Send/Sync bound anywhere.” Without this
bound, Arc<dyn Error> erases the source’s auto-traits, and Error
(and with it the future Client::execute returns) would be !Send for
every transport — tokio::spawn(client.get(u).send()) would never
compile. All three v0.1 backends (hyper, wasi:http, browser fetch
without target_feature = "atomics") already produce Send + Sync
errors, so this pins down a fact rather than adding a new restriction;
a transport with a fundamentally !Send error won’t be able to use
this wrapper.
Implementations§
Source§impl Error
impl Error
pub fn new<E>(kind: ErrorKind, source: E) -> Self
pub fn kind(&self) -> &ErrorKind
pub fn is_timeout(&self) -> bool
pub fn is_redirect(&self) -> bool
pub fn is_connect(&self) -> bool
pub fn is_unsupported(&self) -> bool
pub fn is_cancelled(&self) -> bool
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()