pub trait FdSet:
Clone
+ Default
+ 'static {
const MAX_FD: Fd;
// Required methods
fn insert(&mut self, fd: Fd);
fn remove(&mut self, fd: Fd);
fn contains(&self, fd: Fd) -> bool;
// Provided methods
fn new() -> Self { ... }
fn from_fds<I>(iter: I) -> Self
where I: IntoIterator<Item = Fd> { ... }
}Expand description
Trait for representing a set of file descriptors (FDs)
This is an abstraction over the fd_set type used in the select system
call. It represents a set of Fds that can be monitored for events such
as readability or writability.
As per POSIX, an fd_set can only contain FDs in the range of 0 to
FD_SETSIZE - 1. The MAX_FD associated constant in this
trait represents the maximum FD that can be stored in the set.
Required Associated Constants§
Required Methods§
Sourcefn insert(&mut self, fd: Fd)
fn insert(&mut self, fd: Fd)
Adds an FD to the set.
If the provided FD is greater than MAX_FD or negative,
it will be silently ignored.
Provided Methods§
Sourcefn new() -> Self
fn new() -> Self
Creates a new, empty FD set.
The provided implementation simply calls Default::default.
Sourcefn from_fds<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = Fd>,
fn from_fds<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = Fd>,
Creates a new FD set from an iterator of FDs.
This is a convenience method that creates a new FD set and inserts all
the FDs from the provided iterator into it. If any FD in the iterator is
greater than MAX_FD or negative, it will be silently
ignored.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".