pub struct ReqwestClient<T = Client> {
pub inner: T,
pub base_url: Url,
}Available on crate features
reqwest and rt only.Expand description
Built-in Client adapter pairing a reqwest-style HTTP client with
a base URL. The default T is reqwest::Client; the type alias
ReqwestMiddlewareClient specialises it for
reqwest_middleware::ClientWithMiddleware.
Reqwest’s own client doesn’t carry a base URL, so we pair them at
this layer — generated Interface<C> types then only need to hold
the transport, and the base URL lives in exactly one place.
Fields§
§inner: TThe HTTP client that sends the requests.
base_url: UrlThe API’s base URL.
Implementations§
Source§impl<T> ReqwestClient<T>
impl<T> ReqwestClient<T>
Sourcepub fn try_new(inner: T, base_url: Url) -> Result<Self, UrlParseError>
pub fn try_new(inner: T, base_url: Url) -> Result<Self, UrlParseError>
Pair a reqwest-style client with a base URL.
Returns UrlParseError::RelativeUrlWithCannotBeABaseBase when
base_url cannot serve as a base (e.g. mailto: or a relative
reference). This is the same precondition the previous
Interface::try_new used to enforce.
Trait Implementations§
Source§impl Client for ReqwestClient<Client>
impl Client for ReqwestClient<Client>
Source§type Error = Error
type Error = Error
The transport’s error, returned in
Error::Network.Source§impl Client for ReqwestClient<ClientWithMiddleware>
Available on crate feature reqwest-middleware only.
impl Client for ReqwestClient<ClientWithMiddleware>
Available on crate feature
reqwest-middleware only.Source§type Error = Error
type Error = Error
The transport’s error, returned in
Error::Network.Source§impl<T: Clone> Clone for ReqwestClient<T>
impl<T: Clone> Clone for ReqwestClient<T>
Auto Trait Implementations§
impl<T> Forget for ReqwestClient<T>
impl<T> Freeze for ReqwestClient<T>where
T: Freeze,
impl<T> Move for ReqwestClient<T>
impl<T> RefUnwindSafe for ReqwestClient<T>where
T: RefUnwindSafe,
impl<T> Send for ReqwestClient<T>where
T: Send,
impl<T> Sync for ReqwestClient<T>where
T: Sync,
impl<T> Unpin for ReqwestClient<T>where
T: Unpin,
impl<T> UnsafeUnpin for ReqwestClient<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ReqwestClient<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more