Struct poem::listener::TcpListener
source · pub struct TcpListener<T> { /* private fields */ }
Available on crate feature
server
only.Expand description
A TCP listener.
Implementations
sourceimpl<T> TcpListener<T>
impl<T> TcpListener<T>
sourcepub fn bind(addr: T) -> Self
pub fn bind(addr: T) -> Self
Binds to the provided address, and returns a TcpListener<T>
.
Trait Implementations
sourceimpl<T: ToSocketAddrs + Send> Listener for TcpListener<T>
impl<T: ToSocketAddrs + Send> Listener for TcpListener<T>
type Acceptor = TcpAcceptor
type Acceptor = TcpAcceptor
The acceptor type.
sourcefn into_acceptor<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = IoResult<Self::Acceptor>> + Send + 'async_trait>>where
Self: 'async_trait,
fn into_acceptor<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = IoResult<Self::Acceptor>> + Send + 'async_trait>>where
Self: 'async_trait,
Create a acceptor instance.
sourcefn combine<T>(self, other: T) -> Combined<Self, T>where
Self: Sized,
fn combine<T>(self, other: T) -> Combined<Self, T>where
Self: Sized,
Combine two listeners. Read more
sourcefn rustls<S: IntoTlsConfigStream<RustlsConfig>>(
self,
config_stream: S
) -> RustlsListener<Self, S>where
Self: Sized,
fn rustls<S: IntoTlsConfigStream<RustlsConfig>>(
self,
config_stream: S
) -> RustlsListener<Self, S>where
Self: Sized,
Available on crate feature
rustls
only.Consume this listener and return a new TLS listener with
rustls
.sourcefn native_tls<S: IntoTlsConfigStream<NativeTlsConfig>>(
self,
config_stream: S
) -> NativeTlsListener<Self, S>where
Self: Sized,
fn native_tls<S: IntoTlsConfigStream<NativeTlsConfig>>(
self,
config_stream: S
) -> NativeTlsListener<Self, S>where
Self: Sized,
Available on crate feature
native-tls
only.Consume this listener and return a new TLS listener with
native-tls
.sourcefn openssl_tls<S: IntoTlsConfigStream<OpensslTlsConfig>>(
self,
config_stream: S
) -> OpensslTlsListener<Self, S>where
Self: Sized,
fn openssl_tls<S: IntoTlsConfigStream<OpensslTlsConfig>>(
self,
config_stream: S
) -> OpensslTlsListener<Self, S>where
Self: Sized,
Available on crate feature
openssl-tls
only.Consume this listener and return a new TLS listener with
openssl-tls
.sourcefn acme(self, auto_cert: AutoCert) -> AutoCertListener<Self>where
Self: Sized,
fn acme(self, auto_cert: AutoCert) -> AutoCertListener<Self>where
Self: Sized,
Available on crate feature
acme
only.Consume this listener and return a new ACME listener. Read more
sourcefn boxed(self) -> BoxListenerwhere
Self: Sized + 'static,
fn boxed(self) -> BoxListenerwhere
Self: Sized + 'static,
Wrap the listener in a
Box
.Auto Trait Implementations
impl<T> RefUnwindSafe for TcpListener<T>where
T: RefUnwindSafe,
impl<T> Send for TcpListener<T>where
T: Send,
impl<T> Sync for TcpListener<T>where
T: Sync,
impl<T> Unpin for TcpListener<T>where
T: Unpin,
impl<T> UnwindSafe for TcpListener<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more