Struct safina_net::TcpListener [−][src]
Async wrapper around
std::net::TcpListener
.
Implementations
impl TcpListener
[src]
pub fn new(std_listener: TcpListener) -> Result<Self, Error>
[src]
Wraps an existing listener socket so we can perform async operations on it.
Errors
Returns any
Err(std::io::Error)
returned by
std::net::TcpListener::set_nonblocking
.
pub fn bind<A: ToSocketAddrs>(addr: A) -> Result<TcpListener, Error>
[src]
Returns a TCP listener socket, bound to addr
, that is ready to accept connections.
Errors
Returns any
Err(std::io::Error)
returned by the underlying
std::net::TcpListener::bind
method.
#[must_use]pub fn inner(&self) -> &TcpListener
[src]
#[must_use]pub fn into_inner(self) -> TcpListener
[src]
pub fn try_clone(&self) -> Result<TcpListener, Error>
[src]
Makes a new handle to this socket.
Errors
Returns any
Err(std::io::Error)
returned by the underlying
std::net::TcpListener::try_clone
method.
pub async fn accept(&self) -> Result<(TcpStream, SocketAddr), Error>
[src]
Waits for a new connection and then accepts it. Returns the address of the remote side of the connection and a stream for reading and writing the connection.
Errors
Returns an error if it fails to create a new socket. This happens when the process runs out of file descriptors.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TcpListener
impl Send for TcpListener
impl Sync for TcpListener
impl Unpin for TcpListener
impl UnwindSafe for TcpListener
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,