pub struct Connect<T> { /* private fields */ }
Expand description
Connect request
Implementations§
Source§impl<T: Address> Connect<T>
impl<T: Address> Connect<T>
Sourcepub fn new(req: T) -> Connect<T>
pub fn new(req: T) -> Connect<T>
Create Connect
instance by spliting the string by ‘:’ and convert the second part to u16
Sourcepub fn with(req: T, addr: SocketAddr) -> Connect<T>
pub fn with(req: T, addr: SocketAddr) -> Connect<T>
Create new Connect
instance from host and address. Connector skips name resolution stage for such connect messages.
Sourcepub fn set_port(self, port: u16) -> Self
pub fn set_port(self, port: u16) -> Self
Use port if address does not provide one.
By default it set to 0
Sourcepub fn set_addr(self, addr: Option<SocketAddr>) -> Self
pub fn set_addr(self, addr: Option<SocketAddr>) -> Self
Use address.
Sourcepub fn set_addrs<I>(self, addrs: I) -> Selfwhere
I: IntoIterator<Item = SocketAddr>,
pub fn set_addrs<I>(self, addrs: I) -> Selfwhere
I: IntoIterator<Item = SocketAddr>,
Use addresses.
Sourcepub fn take_addrs(&mut self) -> ConnectTakeAddrsIter
pub fn take_addrs(&mut self) -> ConnectTakeAddrsIter
Takes preresolved addresses of the request.
Trait Implementations§
Source§impl<T: Address> Service<Connect<T>> for Connector<T>
impl<T: Address> Service<Connect<T>> for Connector<T>
Source§type Error = ConnectError
type Error = ConnectError
Errors produced by the service when polling readiness or executing call.
Source§async fn call(
&self,
req: Connect<T>,
_: ServiceCtx<'_, Self>,
) -> Result<Self::Response, Self::Error>
async fn call( &self, req: Connect<T>, _: ServiceCtx<'_, Self>, ) -> Result<Self::Response, Self::Error>
Process the request and return the response asynchronously. Read more
Source§async fn ready(&self, ctx: ServiceCtx<'_, Self>) -> Result<(), Self::Error>
async fn ready(&self, ctx: ServiceCtx<'_, Self>) -> Result<(), Self::Error>
Returns when the service is able to process requests. Read more
Source§fn poll(&self, cx: &mut Context<'_>) -> Result<(), Self::Error>
fn poll(&self, cx: &mut Context<'_>) -> Result<(), Self::Error>
Polls service from the current task. Read more
Source§impl<T: Address> Service<Connect<T>> for Resolver<T>
impl<T: Address> Service<Connect<T>> for Resolver<T>
Source§type Error = ConnectError
type Error = ConnectError
Errors produced by the service when polling readiness or executing call.
Source§async fn call(
&self,
req: Connect<T>,
_: ServiceCtx<'_, Self>,
) -> Result<Connect<T>, Self::Error>
async fn call( &self, req: Connect<T>, _: ServiceCtx<'_, Self>, ) -> Result<Connect<T>, Self::Error>
Process the request and return the response asynchronously. Read more
Source§async fn ready(&self, ctx: ServiceCtx<'_, Self>) -> Result<(), Self::Error>
async fn ready(&self, ctx: ServiceCtx<'_, Self>) -> Result<(), Self::Error>
Returns when the service is able to process requests. Read more
Source§fn poll(&self, cx: &mut Context<'_>) -> Result<(), Self::Error>
fn poll(&self, cx: &mut Context<'_>) -> Result<(), Self::Error>
Polls service from the current task. Read more
Source§impl<T: Address, C> ServiceFactory<Connect<T>, C> for Connector<T>
impl<T: Address, C> ServiceFactory<Connect<T>, C> for Connector<T>
Source§type Error = ConnectError
type Error = ConnectError
Errors produced by the created services.
Source§async fn create(&self, _: C) -> Result<Self::Service, Self::InitError>
async fn create(&self, _: C) -> Result<Self::Service, Self::InitError>
Create and return a new service value asynchronously.
Source§async fn pipeline(
&self,
cfg: Cfg,
) -> Result<Pipeline<Self::Service>, Self::InitError>where
Self: Sized,
async fn pipeline(
&self,
cfg: Cfg,
) -> Result<Pipeline<Self::Service>, Self::InitError>where
Self: Sized,
Create and return a new service value asynchronously and wrap into a container
Source§fn map<F, Res>(
self,
f: F,
) -> ServiceChainFactory<MapFactory<Self, F, Req, Res, Cfg>, Req, Cfg>
fn map<F, Res>( self, f: F, ) -> ServiceChainFactory<MapFactory<Self, F, Req, Res, Cfg>, Req, Cfg>
Map this service’s output to a different type, returning a new service
of the resulting type.
Source§fn map_err<F, E>(
self,
f: F,
) -> ServiceChainFactory<MapErrFactory<Self, Req, Cfg, F, E>, Req, Cfg>
fn map_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapErrFactory<Self, Req, Cfg, F, E>, Req, Cfg>
Map this service’s error to a different error, returning a new service.
Source§fn map_init_err<F, E>(
self,
f: F,
) -> ServiceChainFactory<MapInitErr<Self, Req, Cfg, F, E>, Req, Cfg>
fn map_init_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapInitErr<Self, Req, Cfg, F, E>, Req, Cfg>
Map this factory’s init error to a different error, returning a new service.
Source§impl<T: Address, C> ServiceFactory<Connect<T>, C> for Resolver<T>
impl<T: Address, C> ServiceFactory<Connect<T>, C> for Resolver<T>
Source§type Error = ConnectError
type Error = ConnectError
Errors produced by the created services.
Source§async fn create(&self, _: C) -> Result<Self::Service, Self::InitError>
async fn create(&self, _: C) -> Result<Self::Service, Self::InitError>
Create and return a new service value asynchronously.
Source§async fn pipeline(
&self,
cfg: Cfg,
) -> Result<Pipeline<Self::Service>, Self::InitError>where
Self: Sized,
async fn pipeline(
&self,
cfg: Cfg,
) -> Result<Pipeline<Self::Service>, Self::InitError>where
Self: Sized,
Create and return a new service value asynchronously and wrap into a container
Source§fn map<F, Res>(
self,
f: F,
) -> ServiceChainFactory<MapFactory<Self, F, Req, Res, Cfg>, Req, Cfg>
fn map<F, Res>( self, f: F, ) -> ServiceChainFactory<MapFactory<Self, F, Req, Res, Cfg>, Req, Cfg>
Map this service’s output to a different type, returning a new service
of the resulting type.
Source§fn map_err<F, E>(
self,
f: F,
) -> ServiceChainFactory<MapErrFactory<Self, Req, Cfg, F, E>, Req, Cfg>
fn map_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapErrFactory<Self, Req, Cfg, F, E>, Req, Cfg>
Map this service’s error to a different error, returning a new service.
Source§fn map_init_err<F, E>(
self,
f: F,
) -> ServiceChainFactory<MapInitErr<Self, Req, Cfg, F, E>, Req, Cfg>
fn map_init_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapInitErr<Self, Req, Cfg, F, E>, Req, Cfg>
Map this factory’s init error to a different error, returning a new service.
impl<T: Eq> Eq for Connect<T>
impl<T> StructuralPartialEq for Connect<T>
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> 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