Struct Connector

Source
pub struct Connector { /* private fields */ }
Expand description

Tcp connector

Implementations§

Source§

impl Connector

Source

pub fn new(cfg: ResolverConfig, opts: ResolverOpts) -> Self

Create new connector with resolver configuration

Source

pub fn with_resolver( resolver: Resolver<Connect>, ) -> impl Service<Request = Connect, Response = (Connect, TcpStream), Error = ConnectorError> + Clone

Create new connector with custom resolver

Source

pub fn new_service_with_config<E>( cfg: ResolverConfig, opts: ResolverOpts, ) -> impl NewService<(), Request = Connect, Response = (Connect, TcpStream), Error = ConnectorError, InitError = E> + Clone

Create new default connector service

Trait Implementations§

Source§

impl Clone for Connector

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Connector

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Service for Connector

Source§

type Request = Connect

Requests handled by the service.
Source§

type Response = (Connect, TcpStream)

Responses given by the service.
Source§

type Error = ConnectorError

Errors produced by the service.
Source§

type Future = Either<ConnectorFuture, ConnectorTcpFuture>

The future response value.
Source§

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

Returns Ready when the service is able to process requests. Read more
Source§

fn call(&mut self, req: Connect) -> Self::Future

Process the request and return the response asynchronously. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoService<T> for T
where T: Service,

Source§

fn into_service(self) -> T

Convert to a Service
Source§

impl<T> ServiceExt for T
where T: Service + ?Sized,

Source§

fn apply_fn<F, B, B1, Out>( self, service: B1, f: F, ) -> AndThenApply<Self, B, F, Out>
where Self: Sized, F: FnMut(Self::Response, &mut B) -> Out, Out: IntoFuture, <Out as IntoFuture>::Error: Into<Self::Error>, B: Service<Error = Self::Error>, B1: IntoService<B>,

Apply function to specified service and use it as a next service in chain.
Source§

fn and_then<F, B>(self, service: F) -> AndThen<Self, B>
where Self: Sized, F: IntoService<B>, B: Service<Request = Self::Response, Error = Self::Error>,

Call another service after call to this one has resolved successfully. Read more
Source§

fn from_err<E>(self) -> FromErr<Self, E>
where Self: Sized, E: From<Self::Error>,

Map this service’s error to any error implementing From for this services Error`. Read more
Source§

fn then<B>(self, service: B) -> Then<Self, B>
where Self: Sized, B: Service<Request = Result<Self::Response, Self::Error>, Error = Self::Error>,

Chain on a computation for when a call to the service finished, passing the result of the call to the next service B. Read more
Source§

fn map<F, R>(self, f: F) -> Map<Self, F, R>
where Self: Sized, F: FnMut(Self::Response) -> R,

Map this service’s output to a different type, returning a new service of the resulting type. Read more
Source§

fn map_err<F, E>(self, f: F) -> MapErr<Self, F, E>
where Self: Sized, F: Fn(Self::Error) -> E,

Map this service’s error to a different error, returning a new service. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.