Struct rweb::hyper::Client [−][src]
pub struct Client<C, B = Body> { /* fields omitted */ }
Expand description
A Client to make outgoing HTTP requests.
Implementations
Create a new Client with the default config.
Note
The default connector does not handle TLS. Speaking to https
destinations will require configuring a connector that implements
TLS.
pub fn get(&self, uri: Uri) -> ResponseFutureⓘNotable traits for ResponseFuture
impl Future for ResponseFuture type Output = Result<Response<Body>, Error>;
where
B: Default,
pub fn get(&self, uri: Uri) -> ResponseFutureⓘNotable traits for ResponseFuture
impl Future for ResponseFuture type Output = Result<Response<Body>, Error>;
where
B: Default,
Send a GET
request to the supplied Uri
.
Note
This requires that the HttpBody
type have a Default
implementation.
It should return an “empty” version of itself, such that
HttpBody::is_end_stream
is true
.
Example
use hyper::{Client, Uri}; let client = Client::new(); let future = client.get(Uri::from_static("http://httpbin.org/ip"));
pub fn request(&self, req: Request<B>) -> ResponseFutureⓘNotable traits for ResponseFuture
impl Future for ResponseFuture type Output = Result<Response<Body>, Error>;
pub fn request(&self, req: Request<B>) -> ResponseFutureⓘNotable traits for ResponseFuture
impl Future for ResponseFuture type Output = Result<Response<Body>, Error>;
Send a constructed Request
using this Client
.
Example
use hyper::{Body, Client, Request}; let client = Client::new(); let req = Request::builder() .method("POST") .uri("http://httpbin.org/post") .body(Body::from("Hallo!")) .expect("request builder"); let future = client.request(req);
Trait Implementations
Returns the “default value” for a type. Read more
type Future = ResponseFuture
type Future = ResponseFuture
The future response value.
Returns Poll::Ready(Ok(()))
when the service is able to process requests. Read more
type Future = ResponseFuture
type Future = ResponseFuture
The future response value.
Returns Poll::Ready(Ok(()))
when the service is able to process requests. Read more
Auto Trait Implementations
impl<C, B = Body> !RefUnwindSafe for Client<C, B>
impl<C, B = Body> !UnwindSafe for Client<C, B>
Blanket Implementations
Mutably borrows from an owned value. Read more
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V