Struct rustix::io::epoll::Epoll
pub struct Epoll<Context: self::Context> { /* fields hidden */ }
Documentation
An “epoll”, an interface to an OS object allowing one to repeatedly wait for events from a set of file descriptors efficiently.
Implementations
impl<Context: self::Context> Epoll<Context>
pub fn new(flags: CreateFlags, context: Context) -> io::Result<Self>
epoll_create1(flags)
—Creates a new Epoll
.
Use the CreateFlags::CLOEXEC
flag to prevent the resulting file
descriptor from being implicitly passed across exec
boundaries.
pub fn add(
&Self,
data: Context::Data,
event_flags: EventFlags
) -> io::Result<Ref<'_, Context::Target>>
&Self,
data: Context::Data,
event_flags: EventFlags
) -> io::Result<Ref<'_, Context::Target>>
epoll_ctl(self, EPOLL_CTL_ADD, data, event)
—Adds an element to an
Epoll
.
This registers interest in any of the events set in events
occurring
on the file descriptor associated with data
.
pub fn mod_(
&Self,
target: Ref<'_, Context::Target>,
event_flags: EventFlags
) -> io::Result<()>
&Self,
target: Ref<'_, Context::Target>,
event_flags: EventFlags
) -> io::Result<()>
epoll_ctl(self, EPOLL_CTL_MOD, target, event)
—Modifies an element in
this Epoll
.
This sets the events of interest with target
to events
.
pub fn del(&Self, target: Ref<'_, Context::Target>) -> io::Result<Context::Data>
epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)
—Removes an element in
this Epoll
.
This also returns the owning Data
.
pub fn wait<'context>(
&'context Self,
event_list: &mut EventVec<'context, Context>,
timeout: c::c_int
) -> io::Result<()>
&'context Self,
event_list: &mut EventVec<'context, Context>,
timeout: c::c_int
) -> io::Result<()>
epoll_wait(self, events, timeout)
—Waits for registered events of
interest.
For each event of interest, an element is written to events
. On
success, this returns the number of written elements.
Trait Implementations
impl<'context, T: AsFd + IntoFd + FromFd> FromRawFd for Epoll<Owning<'context, T>>
unsafe fn from_raw_fd(fd: RawFd) -> Self
impl<'context, T: AsFd + IntoFd + FromFd> IntoRawFd for Epoll<Owning<'context, T>>
fn into_raw_fd(Self) -> RawFd
Auto Trait Implementations
impl<Context> RefUnwindSafe for Epoll<Context>
where
Context: RefUnwindSafe,
impl<Context> UnwindSafe for Epoll<Context>
where
Context: UnwindSafe,
Blanket Implementations
impl<T> AsFilelike for T
where
T: AsFd,
where
T: AsFd,
fn as_filelike(&Self) -> BorrowedFd<'_>
fn as_filelike_view<Target>(&Self) -> FilelikeView<'_, Target>
where
Target: FromFilelike + IntoFilelike
impl<T> AsRawFilelike for T
where
T: AsRawFd,
where
T: AsRawFd,
fn as_raw_filelike(&Self) -> i32
impl<T> AsRawSocketlike for T
where
T: AsRawFd,
where
T: AsRawFd,
fn as_raw_socketlike(&Self) -> i32
impl<T> AsSocketlike for T
where
T: AsFd,
where
T: AsFd,
fn as_socketlike(&Self) -> BorrowedFd<'_>
fn as_socketlike_view<Target>(&Self) -> FilelikeView<'_, Target>
where
Target: FromSocketlike + IntoSocketlike
impl<T> BorrowMut<T> for T
where
T: ?Sized,
where
T: ?Sized,
fn borrow_mut(&mut Self) -> &mut T
impl<T> FromRawFilelike for T
where
T: FromRawFd,
where
T: FromRawFd,
unsafe fn from_raw_filelike(raw: i32) -> T
impl<T> FromRawSocketlike for T
where
T: FromRawFd,
where
T: FromRawFd,
unsafe fn from_raw_socketlike(raw: i32) -> T
impl<T> IntoRawFilelike for T
where
T: IntoRawFd,
where
T: IntoRawFd,
fn into_raw_filelike(Self) -> i32