[][src]Struct tower_hyper::client::Client

pub struct Client<C, B> { /* fields omitted */ }

The client wrapp for hyper::Client

The generics C and B are 1-1 with the generic types within hyper::Client.

Methods

impl<B> Client<HttpConnector, B> where
    B: HttpBody + Send + 'static,
    B::Data: Send,
    B::Error: Into<Box<dyn Error + Send + Sync>>, 
[src]

pub fn new() -> Self[src]

Create a new client, using the default hyper settings

impl<C, B> Client<C, B>[src]

pub fn with_client(inner: Client<C, LiftBody<B>>) -> Self[src]

Create a new client by providing the inner hyper::Client

Example

The existing default is:

   use http::Request;
   use tower_hyper::client::Client;
   use tower_service::Service;

   let inner = hyper::Client::builder().build_http();
   let mut client = Client::with_client(inner);
   let _ = client.call(Request::new(vec![0, 1, 2]));

which returns a Client<HttpConnector, B> for any B: HttpBody.

Trait Implementations

impl<C: Clone, B: Clone> Clone for Client<C, B>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<C: Debug, B: Debug> Debug for Client<C, B>[src]

impl<C, B> Service<Request<B>> for Client<C, B> where
    C: HyperConnect + Sync + 'static,
    C::Transport: 'static,
    C::Future: 'static,
    B: HttpBody + Send + 'static,
    B::Data: Send,
    B::Error: Into<Box<dyn Error + Send + Sync>>, 
[src]

type Response = Response<Body>

Responses given by the service.

type Error = Error

Errors produced by the service.

type Future = ResponseFuture<ResponseFuture>

The future response value.

fn poll_ready(&mut self) -> Poll<(), Self::Error>[src]

Poll to see if the service is ready, since hyper::Client already handles this internally this will always return ready

fn call(&mut self, req: Request<B>) -> Self::Future[src]

Send the sepcficied request to the inner hyper::Client

Auto Trait Implementations

impl<C, B> Sync for Client<C, B> where
    B: Send,
    C: Send + Sync

impl<C, B> Send for Client<C, B> where
    B: Send,
    C: Send + Sync

impl<C, B> Unpin for Client<C, B>

impl<C, B> !RefUnwindSafe for Client<C, B>

impl<C, B> !UnwindSafe for Client<C, B>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T, B1, B2> HttpService<B1> for T where
    B2: Body,
    T: Service<Request<B1>, Response = Response<B2>>, 
[src]

type ResponseBody = B2

Response payload.

type Error = <T as Service<Request<B1>>>::Error

Errors produced by the service.

type Future = <T as Service<Request<B1>>>::Future

The future response value.

fn into_service(self) -> IntoService<Self>[src]

Wrap the HttpService so that it implements tower_service::Service directly. Read more

fn as_service(&mut self) -> AsService<Self>[src]

Same as into_service but operates on an HttpService reference.