pub struct UnixListener { /* private fields */ }
Expand description
A non-blocking Unix domain socket server.
Implementations§
Source§impl UnixListener
impl UnixListener
Sourcepub fn bind<P: AsRef<Path>>(path: P) -> Result<UnixListener>
pub fn bind<P: AsRef<Path>>(path: P) -> Result<UnixListener>
Creates a new UnixListener
bound to the specified socket path
.
Sourcepub fn bind_addr(address: &SocketAddr) -> Result<UnixListener>
pub fn bind_addr(address: &SocketAddr) -> Result<UnixListener>
Creates a new UnixListener
bound to the specified socket address
.
Sourcepub fn from_std(listener: UnixListener) -> UnixListener
pub fn from_std(listener: UnixListener) -> UnixListener
Creates a new UnixListener
from a standard net::UnixListener
.
This function is intended to be used to wrap a Unix listener from the standard library in the Mio equivalent. The conversion assumes nothing about the underlying listener; it is left up to the user to set it in non-blocking mode.
Sourcepub fn accept(&self) -> Result<(UnixStream, SocketAddr)>
pub fn accept(&self) -> Result<(UnixStream, SocketAddr)>
Accepts a new incoming connection to this listener.
The call is responsible for ensuring that the listening socket is in non-blocking mode.
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Returns the local socket address of this listener.
Sourcepub fn take_error(&self) -> Result<Option<Error>>
pub fn take_error(&self) -> Result<Option<Error>>
Returns the value of the SO_ERROR
option.
Trait Implementations§
Source§impl AsFd for UnixListener
impl AsFd for UnixListener
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Source§impl AsRawFd for UnixListener
impl AsRawFd for UnixListener
Source§impl Debug for UnixListener
impl Debug for UnixListener
Source§impl From<OwnedFd> for UnixListener
impl From<OwnedFd> for UnixListener
Source§impl From<UnixListener> for OwnedFd
impl From<UnixListener> for OwnedFd
Source§fn from(unix_listener: UnixListener) -> Self
fn from(unix_listener: UnixListener) -> Self
Source§impl From<UnixListener> for UnixListener
impl From<UnixListener> for UnixListener
Source§fn from(listener: UnixListener) -> Self
fn from(listener: UnixListener) -> Self
Source§impl FromRawFd for UnixListener
impl FromRawFd for UnixListener
Source§unsafe fn from_raw_fd(fd: RawFd) -> UnixListener
unsafe fn from_raw_fd(fd: RawFd) -> UnixListener
Converts a RawFd
to a UnixListener
.
§Notes
The caller is responsible for ensuring that the socket is in non-blocking mode.