pub struct Client { /* private fields */ }
Expand description
reexport hyper’s Client to sapper level A Client to use additional features with Requests.
Clients can handle things such as: redirect policy, connection pooling.
Implementations§
Source§impl Client
impl Client
Sourcepub fn with_pool_config(config: Config) -> Client
pub fn with_pool_config(config: Config) -> Client
Create a new Client with a configured Pool Config.
Sourcepub fn with_http_proxy<H>(host: H, port: u16) -> Client
pub fn with_http_proxy<H>(host: H, port: u16) -> Client
Create a Client with an HTTP proxy to a (host, port).
Sourcepub fn with_proxy_config<C, S>(proxy_config: ProxyConfig<C, S>) -> Clientwhere
C: NetworkConnector + Send + Sync + 'static,
<C as NetworkConnector>::Stream: NetworkStream + Send + Clone,
S: SslClient<<C as NetworkConnector>::Stream> + Send + Sync + 'static,
pub fn with_proxy_config<C, S>(proxy_config: ProxyConfig<C, S>) -> Clientwhere
C: NetworkConnector + Send + Sync + 'static,
<C as NetworkConnector>::Stream: NetworkStream + Send + Clone,
S: SslClient<<C as NetworkConnector>::Stream> + Send + Sync + 'static,
Create a Client using a proxy with a custom connector and SSL client.
Sourcepub fn with_connector<C, S>(connector: C) -> Client
pub fn with_connector<C, S>(connector: C) -> Client
Create a new client with a specific connector.
Sourcepub fn with_protocol<P>(protocol: P) -> Client
pub fn with_protocol<P>(protocol: P) -> Client
Create a new client with a specific Protocol
.
Sourcepub fn set_redirect_policy(&mut self, policy: RedirectPolicy)
pub fn set_redirect_policy(&mut self, policy: RedirectPolicy)
Set the RedirectPolicy.
Sourcepub fn set_read_timeout(&mut self, dur: Option<Duration>)
pub fn set_read_timeout(&mut self, dur: Option<Duration>)
Set the read timeout value for all requests.
Sourcepub fn set_write_timeout(&mut self, dur: Option<Duration>)
pub fn set_write_timeout(&mut self, dur: Option<Duration>)
Set the write timeout value for all requests.
Sourcepub fn get<U>(&self, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
pub fn get<U>(&self, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
Build a Get request.
Sourcepub fn head<U>(&self, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
pub fn head<U>(&self, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
Build a Head request.
Sourcepub fn patch<U>(&self, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
pub fn patch<U>(&self, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
Build a Patch request.
Sourcepub fn post<U>(&self, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
pub fn post<U>(&self, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
Build a Post request.
Sourcepub fn put<U>(&self, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
pub fn put<U>(&self, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
Build a Put request.
Sourcepub fn delete<U>(&self, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
pub fn delete<U>(&self, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
Build a Delete request.
Sourcepub fn request<U>(&self, method: Method, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
pub fn request<U>(&self, method: Method, url: U) -> RequestBuilder<'_>where
U: IntoUrl,
Build a new request using this Client.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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