Struct listenfd::ListenFd
[−]
[src]
pub struct ListenFd { /* fields omitted */ }
A helper object that gives access to raw file descriptors.
Methods
impl ListenFd
[src]
pub fn from_env() -> ListenFd
[src]
Creates the listenfd manager object from the environment.
pub fn empty() -> ListenFd
[src]
Creates an empty listenfd object.
This is helpful when the ability to work with external file descriptors should be disabled in certain code paths. This way the functions on the object will just never return sockets.
pub fn len(&self) -> usize
[src]
Returns the number of fds in the manager object.
Note that even if fds are taken out of the manager this count does not change.
pub fn take_tcp_listener(&mut self, idx: usize) -> Result<Option<TcpListener>>
[src]
Takes the TCP listener at an index.
If the given index has been used before Ok(None)
is returned,
otherwise the fd at that index is returned as TcpListener
. If
the fd at that position is not a tcp socket then an error is
returned and the fd is left at its place.
pub fn take_unix_listener(&mut self, idx: usize) -> Result<Option<UnixListener>>
[src]
Takes the UNIX listener at an index.
If the given index has been used before Ok(None)
is returned,
otherwise the fd at that index is returned as UnixListener
. If
the fd at that position is not a tcp socket then an error is
returned and the fd is left at its place.
This function is only available on unix platforms.
pub fn take_udp_socket(&mut self, idx: usize) -> Result<Option<UdpSocket>>
[src]
Takes the UDP socket at an index.
If the given index has been used before Ok(None)
is returned,
otherwise the fd at that index is returned as UdpSocket
. If
the fd at that position is not a tcp socket then an error is
returned and the fd is left at its place.
pub fn take_raw_fd(&mut self, idx: usize) -> Result<Option<RawFd>>
[src]
Takes the RawFd
on unix platforms.