Struct actix_tls::connect::ConnectInfo
source · pub struct ConnectInfo<R> { /* private fields */ }
Available on crate feature
connect
only.Expand description
Connection request information.
May contain known/pre-resolved socket address(es) or a host that needs resolving with DNS.
Implementations§
source§impl<R: Host> ConnectInfo<R>
impl<R: Host> ConnectInfo<R>
sourcepub fn new(request: R) -> ConnectInfo<R>
pub fn new(request: R) -> ConnectInfo<R>
Constructs new connection info using a request.
sourcepub fn with_addr(request: R, addr: SocketAddr) -> ConnectInfo<R>
pub fn with_addr(request: R, addr: SocketAddr) -> ConnectInfo<R>
Constructs new connection info from request and known socket address.
Since socket address is known, Connector
will skip the DNS
resolution step.
sourcepub fn set_port(self, port: u16) -> Self
pub fn set_port(self, port: u16) -> Self
Set connection port.
If request provided a port, this will override it.
sourcepub fn set_addr(self, addr: impl Into<Option<SocketAddr>>) -> Self
pub fn set_addr(self, addr: impl Into<Option<SocketAddr>>) -> Self
Set connection socket 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>,
Set list of addresses.
sourcepub fn set_local_addr(self, addr: impl Into<IpAddr>) -> Self
pub fn set_local_addr(self, addr: impl Into<IpAddr>) -> Self
Set local address to connection with.
Useful in situations where the IP address bound to a particular network interface is known. This would make sure the socket is opened through that interface.
sourcepub fn addrs(
&self
) -> impl Iterator<Item = SocketAddr> + ExactSizeIterator + FusedIterator + Clone + Debug + '_
pub fn addrs( &self ) -> impl Iterator<Item = SocketAddr> + ExactSizeIterator + FusedIterator + Clone + Debug + '_
Get borrowed iterator of resolved request addresses.
§Examples
let addr = SocketAddr::from(([127, 0, 0, 1], 4242));
let conn = ConnectInfo::new("localhost");
let mut addrs = conn.addrs();
assert!(addrs.next().is_none());
let conn = ConnectInfo::with_addr("localhost", addr);
let mut addrs = conn.addrs();
assert_eq!(addrs.next().unwrap(), addr);
sourcepub fn take_addrs(
&mut self
) -> impl Iterator<Item = SocketAddr> + ExactSizeIterator + FusedIterator + Clone + Debug + 'static
pub fn take_addrs( &mut self ) -> impl Iterator<Item = SocketAddr> + ExactSizeIterator + FusedIterator + Clone + Debug + 'static
Take owned iterator resolved request addresses.
§Examples
let addr = SocketAddr::from(([127, 0, 0, 1], 4242));
let mut conn = ConnectInfo::new("localhost");
let mut addrs = conn.take_addrs();
assert!(addrs.next().is_none());
let mut conn = ConnectInfo::with_addr("localhost", addr);
let mut addrs = conn.take_addrs();
assert_eq!(addrs.next().unwrap(), addr);
Trait Implementations§
source§impl<R: Debug> Debug for ConnectInfo<R>
impl<R: Debug> Debug for ConnectInfo<R>
source§impl<R: Host> Display for ConnectInfo<R>
impl<R: Host> Display for ConnectInfo<R>
source§impl<R: Host> From<R> for ConnectInfo<R>
impl<R: Host> From<R> for ConnectInfo<R>
source§impl<R: Hash> Hash for ConnectInfo<R>
impl<R: Hash> Hash for ConnectInfo<R>
source§impl<R: PartialEq> PartialEq for ConnectInfo<R>
impl<R: PartialEq> PartialEq for ConnectInfo<R>
source§fn eq(&self, other: &ConnectInfo<R>) -> bool
fn eq(&self, other: &ConnectInfo<R>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<R: Host> Service<ConnectInfo<R>> for ConnectorService
impl<R: Host> Service<ConnectInfo<R>> for ConnectorService
§type Response = Connection<R, TcpStream>
type Response = Connection<R, TcpStream>
Responses given by the service.
§type Error = ConnectError
type Error = ConnectError
Errors produced by the service when polling readiness or executing call.
source§impl<R: Host> Service<ConnectInfo<R>> for ResolverService
impl<R: Host> Service<ConnectInfo<R>> for ResolverService
§type Response = ConnectInfo<R>
type Response = ConnectInfo<R>
Responses given by the service.
§type Error = ConnectError
type Error = ConnectError
Errors produced by the service when polling readiness or executing call.
source§impl<R: Host> Service<ConnectInfo<R>> for TcpConnectorService
impl<R: Host> Service<ConnectInfo<R>> for TcpConnectorService
§type Response = Connection<R, TcpStream>
type Response = Connection<R, TcpStream>
Responses given by the service.
§type Error = ConnectError
type Error = ConnectError
Errors produced by the service when polling readiness or executing call.
source§impl<R: Host> ServiceFactory<ConnectInfo<R>> for Connector
impl<R: Host> ServiceFactory<ConnectInfo<R>> for Connector
§type Response = Connection<R, TcpStream>
type Response = Connection<R, TcpStream>
Responses given by the created services.
§type Error = ConnectError
type Error = ConnectError
Errors produced by the created services.
§type Service = ConnectorService
type Service = ConnectorService
The kind of
Service
created by this factory.§type Future = Ready<Result<<Connector as ServiceFactory<ConnectInfo<R>>>::Service, <Connector as ServiceFactory<ConnectInfo<R>>>::InitError>>
type Future = Ready<Result<<Connector as ServiceFactory<ConnectInfo<R>>>::Service, <Connector as ServiceFactory<ConnectInfo<R>>>::InitError>>
The future of the
Service
instance.gsource§fn new_service(&self, _: ()) -> Self::Future
fn new_service(&self, _: ()) -> Self::Future
Create and return a new service asynchronously.
source§impl<R: Host> ServiceFactory<ConnectInfo<R>> for Resolver
impl<R: Host> ServiceFactory<ConnectInfo<R>> for Resolver
§type Response = ConnectInfo<R>
type Response = ConnectInfo<R>
Responses given by the created services.
§type Error = ConnectError
type Error = ConnectError
Errors produced by the created services.
§type Service = ResolverService
type Service = ResolverService
The kind of
Service
created by this factory.§type Future = Ready<Result<<Resolver as ServiceFactory<ConnectInfo<R>>>::Service, <Resolver as ServiceFactory<ConnectInfo<R>>>::InitError>>
type Future = Ready<Result<<Resolver as ServiceFactory<ConnectInfo<R>>>::Service, <Resolver as ServiceFactory<ConnectInfo<R>>>::InitError>>
The future of the
Service
instance.gsource§fn new_service(&self, _: ()) -> Self::Future
fn new_service(&self, _: ()) -> Self::Future
Create and return a new service asynchronously.
source§impl<R: Host> ServiceFactory<ConnectInfo<R>> for TcpConnector
impl<R: Host> ServiceFactory<ConnectInfo<R>> for TcpConnector
§type Response = Connection<R, TcpStream>
type Response = Connection<R, TcpStream>
Responses given by the created services.
§type Error = ConnectError
type Error = ConnectError
Errors produced by the created services.
§type Service = TcpConnectorService
type Service = TcpConnectorService
The kind of
Service
created by this factory.§type Future = Ready<Result<<TcpConnector as ServiceFactory<ConnectInfo<R>>>::Service, <TcpConnector as ServiceFactory<ConnectInfo<R>>>::InitError>>
type Future = Ready<Result<<TcpConnector as ServiceFactory<ConnectInfo<R>>>::Service, <TcpConnector as ServiceFactory<ConnectInfo<R>>>::InitError>>
The future of the
Service
instance.gsource§fn new_service(&self, _: ()) -> Self::Future
fn new_service(&self, _: ()) -> Self::Future
Create and return a new service asynchronously.
impl<R: Eq> Eq for ConnectInfo<R>
impl<R> StructuralPartialEq for ConnectInfo<R>
Auto Trait Implementations§
impl<R> Freeze for ConnectInfo<R>where
R: Freeze,
impl<R> RefUnwindSafe for ConnectInfo<R>where
R: RefUnwindSafe,
impl<R> Send for ConnectInfo<R>where
R: Send,
impl<R> Sync for ConnectInfo<R>where
R: Sync,
impl<R> Unpin for ConnectInfo<R>where
R: Unpin,
impl<R> UnwindSafe for ConnectInfo<R>where
R: 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