Struct Connect

Source
pub struct Connect<A, B, C, E> { /* private fields */ }
Expand description

Creates a hyper connection

This accepts a hyper::client::conn::Builder and provides a MakeService implementation to create connections from some target A

Implementations§

Source§

impl<A, B, C> Connect<A, B, C, DefaultExecutor>
where C: HttpMakeConnection<A>, B: HttpBody, C::Connection: Send + 'static,

Source

pub fn new(inner: C) -> Self

Create a new Connect.

The C argument is used to obtain new session layer instances (AsyncRead + AsyncWrite). For each new client service returned, a Service is returned that can be driven by poll_service and to send requests via call.

Source

pub fn with_builder(inner: C, builder: Builder) -> Self

Create a new Connect with a builder.

Source§

impl<A, B, C, E> Connect<A, B, C, E>
where C: HttpMakeConnection<A>, B: HttpBody, C::Connection: Send + 'static,

Source

pub fn with_executor(inner: C, builder: Builder, exec: E) -> Self

Create a new Connect.

The C argument is used to obtain new session layer instances (AsyncRead + AsyncWrite). For each new client service returned, a Service is returned that can be driven by poll_service and to send requests via call.

The E argument is the executor that the background task for the connection will be spawned on.

Trait Implementations§

Source§

impl<A: Debug, B: Debug, C: Debug, E: Debug> Debug for Connect<A, B, C, E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A, B, C, E> Service<A> for Connect<A, B, C, E>
where C: HttpMakeConnection<A> + 'static, B: HttpBody + Send + 'static, B::Data: Send, B::Error: Into<Box<dyn Error + Send + Sync>>, C::Connection: Send + 'static, E: ConnectExecutor<C::Connection, B> + Clone,

Source§

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

Check if the MakeConnection is ready for a new connection.

Source§

fn call(&mut self, target: A) -> Self::Future

Obtains a Connection on a single plaintext h2 connection to a remote.

Source§

type Response = Connection<B>

Responses given by the service.
Source§

type Error = ConnectError<<C as HttpMakeConnection<A>>::Error>

Errors produced by the service.
Source§

type Future = ConnectFuture<A, B, C, E>

The future response value.

Auto Trait Implementations§

§

impl<A, B, C, E> Freeze for Connect<A, B, C, E>
where C: Freeze, E: Freeze,

§

impl<A, B, C, E> !RefUnwindSafe for Connect<A, B, C, E>

§

impl<A, B, C, E> Send for Connect<A, B, C, E>
where C: Send, E: Send, A: Send, B: Send,

§

impl<A, B, C, E> Sync for Connect<A, B, C, E>
where C: Sync, E: Sync, A: Sync, B: Sync,

§

impl<A, B, C, E> Unpin for Connect<A, B, C, E>
where C: Unpin, E: Unpin, A: Unpin, B: Unpin,

§

impl<A, B, C, E> !UnwindSafe for Connect<A, B, C, E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<M, S, Target, Request> MakeService<Target, Request> for M
where M: Service<Target, Response = S>, S: Service<Request>,

Source§

type Response = <S as Service<Request>>::Response

Responses given by the service
Source§

type Error = <S as Service<Request>>::Error

Errors produced by the service
Source§

type Service = S

The Service value created by this factory
Source§

type MakeError = <M as Service<Target>>::Error

Errors produced while building a service.
Source§

type Future = <M as Service<Target>>::Future

The future of the Service instance.
Source§

fn poll_ready( &mut self, ) -> Result<Async<()>, <M as MakeService<Target, Request>>::MakeError>

Returns Ready when the factory is able to process create more services. Read more
Source§

fn make_service( &mut self, target: Target, ) -> <M as MakeService<Target, Request>>::Future

Create and return a new service value asynchronously.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.