pub struct Connect<T> { /* private fields */ }Expand description
Request to resolve and connect to a remote address.
Implementations§
Source§impl<T> Connect<T>where
T: Address,
impl<T> Connect<T>where
T: Address,
Sourcepub fn new(req: T) -> Connect<T>
pub fn new(req: T) -> Connect<T>
Creates a connection request and derives a port from the host when present.
Sourcepub fn with(req: T, addr: SocketAddr) -> Connect<T>
pub fn with(req: T, addr: SocketAddr) -> Connect<T>
Creates a request with a pre-resolved socket address.
The connector skips DNS resolution for this request.
Sourcepub fn set_port(self, port: u16) -> Connect<T>
pub fn set_port(self, port: u16) -> Connect<T>
Sets the port used when Address::port() does not provide one.
This replaces the port parsed from a host:port host by
new(), which is zero if the host has none.
Sourcepub fn set_addr(self, addr: Option<SocketAddr>) -> Connect<T>
pub fn set_addr(self, addr: Option<SocketAddr>) -> Connect<T>
Sets one pre-resolved socket address.
Sourcepub fn set_addrs<I>(self, addrs: I) -> Connect<T>where
I: IntoIterator<Item = SocketAddr>,
pub fn set_addrs<I>(self, addrs: I) -> Connect<T>where
I: IntoIterator<Item = SocketAddr>,
Sets multiple pre-resolved socket addresses.
Sourcepub fn port(&self) -> u16
pub fn port(&self) -> u16
Returns the port from Address::port(), or the one parsed from the
host or set by set_port().
Sourcepub fn addrs(&self) -> ConnectAddrsIter<'_>
pub fn addrs(&self) -> ConnectAddrsIter<'_>
Iterates over the request’s pre-resolved addresses.
Sourcepub fn take_addrs(&mut self) -> ConnectTakeAddrsIter
pub fn take_addrs(&mut self) -> ConnectTakeAddrsIter
Removes and returns the request’s pre-resolved addresses.
Trait Implementations§
impl<T> Eq for Connect<T>where
T: Eq,
Source§type Error = Error<ConnectError>
type Error = Error<ConnectError>
Error produced while checking readiness or processing a request.
Source§async fn call(
&self,
req: Connect<A>,
ctx: Ctx<'_, Connector<A>, SharedCfg>,
) -> Result<Io, <Connector<A> as Service<SharedCfg, Connect<A>>>::Error>
async fn call( &self, req: Connect<A>, ctx: Ctx<'_, Connector<A>, SharedCfg>, ) -> Result<Io, <Connector<A> as Service<SharedCfg, Connect<A>>>::Error>
Processes a request and asynchronously returns the response. Read more
Source§async fn ready(&self, ctx: Ctx<'_, Self, St>) -> Result<(), Self::Error>
async fn ready(&self, ctx: Ctx<'_, Self, St>) -> Result<(), Self::Error>
Waits until the service is ready to process a request. Read more
Source§fn map<F, Res>(self, f: F) -> ServiceChain<Map<F, Self, Res>, St, Req>
fn map<F, Res>(self, f: F) -> ServiceChain<Map<F, Self, Res>, St, Req>
Maps this service’s output to a different type, returning a new service. Read more
Source§fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<F, Self, E>, St, Req>
fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<F, Self, E>, St, Req>
Maps this service’s error to a different type, returning a new service. Read more
Source§type Error = Error<ConnectError>
type Error = Error<ConnectError>
Error produced while checking readiness or processing a request.
Source§async fn call(
&self,
req: Connect<A>,
ctx: Ctx<'_, SslConnector<S>, SharedCfg>,
) -> Result<<SslConnector<S> as Service<SharedCfg, Connect<A>>>::Res, <SslConnector<S> as Service<SharedCfg, Connect<A>>>::Error>
async fn call( &self, req: Connect<A>, ctx: Ctx<'_, SslConnector<S>, SharedCfg>, ) -> Result<<SslConnector<S> as Service<SharedCfg, Connect<A>>>::Res, <SslConnector<S> as Service<SharedCfg, Connect<A>>>::Error>
Processes a request and asynchronously returns the response. Read more
Source§async fn ready(
&self,
ctx: Ctx<'_, SslConnector<S>, SharedCfg>,
) -> Result<(), <SslConnector<S> as Service<SharedCfg, Connect<A>>>::Error>
async fn ready( &self, ctx: Ctx<'_, SslConnector<S>, SharedCfg>, ) -> Result<(), <SslConnector<S> as Service<SharedCfg, Connect<A>>>::Error>
Waits until the service is ready to process a request. Read more
Source§async fn shutdown(&self, ctx: Ctx<'_, SslConnector<S>, SharedCfg>)
async fn shutdown(&self, ctx: Ctx<'_, SslConnector<S>, SharedCfg>)
Shuts down the service. Read more
Source§fn map<F, Res>(self, f: F) -> ServiceChain<Map<F, Self, Res>, St, Req>
fn map<F, Res>(self, f: F) -> ServiceChain<Map<F, Self, Res>, St, Req>
Maps this service’s output to a different type, returning a new service. Read more
Source§fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<F, Self, E>, St, Req>
fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<F, Self, E>, St, Req>
Maps this service’s error to a different type, returning a new service. Read more
Source§type Error = Error<ConnectError>
type Error = Error<ConnectError>
Error produced while checking readiness or processing a request.
Source§async fn call(
&self,
req: Connect<A>,
ctx: Ctx<'_, TlsConnector<S>, SharedCfg>,
) -> Result<<TlsConnector<S> as Service<SharedCfg, Connect<A>>>::Res, <TlsConnector<S> as Service<SharedCfg, Connect<A>>>::Error>
async fn call( &self, req: Connect<A>, ctx: Ctx<'_, TlsConnector<S>, SharedCfg>, ) -> Result<<TlsConnector<S> as Service<SharedCfg, Connect<A>>>::Res, <TlsConnector<S> as Service<SharedCfg, Connect<A>>>::Error>
Processes a request and asynchronously returns the response. Read more
Source§async fn ready(
&self,
ctx: Ctx<'_, TlsConnector<S>, SharedCfg>,
) -> Result<(), <TlsConnector<S> as Service<SharedCfg, Connect<A>>>::Error>
async fn ready( &self, ctx: Ctx<'_, TlsConnector<S>, SharedCfg>, ) -> Result<(), <TlsConnector<S> as Service<SharedCfg, Connect<A>>>::Error>
Waits until the service is ready to process a request. Read more
Source§async fn shutdown(&self, ctx: Ctx<'_, TlsConnector<S>, SharedCfg>)
async fn shutdown(&self, ctx: Ctx<'_, TlsConnector<S>, SharedCfg>)
Shuts down the service. Read more
Source§fn map<F, Res>(self, f: F) -> ServiceChain<Map<F, Self, Res>, St, Req>
fn map<F, Res>(self, f: F) -> ServiceChain<Map<F, Self, Res>, St, Req>
Maps this service’s output to a different type, returning a new service. Read more
Source§fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<F, Self, E>, St, Req>
fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<F, Self, E>, St, Req>
Maps this service’s error to a different type, returning a new service. Read more
impl<T> StructuralPartialEq for Connect<T>where
T: PartialEq,
Auto Trait Implementations§
impl<T> Freeze for Connect<T>where
T: Freeze,
impl<T> RefUnwindSafe for Connect<T>where
T: RefUnwindSafe,
impl<T> Send for Connect<T>where
T: Send,
impl<T> Sync for Connect<T>where
T: Sync,
impl<T> Unpin for Connect<T>where
T: Unpin,
impl<T> UnsafeUnpin for Connect<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Connect<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.