pub struct Epoll<Context: Context> { /* private fields */ }
Expand description
An “epoll”, an interface to an OS object allowing one to repeatedly wait for events from a set of file descriptors efficiently.
Implementations§
source§impl<Context: Context> Epoll<Context>
impl<Context: Context> Epoll<Context>
sourcepub fn new(flags: CreateFlags, context: Context) -> Result<Self>
pub fn new(flags: CreateFlags, context: Context) -> 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.
sourcepub fn add(
&self,
data: Context::Data,
event_flags: EventFlags
) -> Result<Ref<'_, Context::Target>>
pub fn add(
&self,
data: Context::Data,
event_flags: EventFlags
) -> 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
.
sourcepub fn mod_(
&self,
target: Ref<'_, Context::Target>,
event_flags: EventFlags
) -> Result<()>
pub fn mod_(
&self,
target: Ref<'_, Context::Target>,
event_flags: EventFlags
) -> 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
.
sourcepub fn del(&self, target: Ref<'_, Context::Target>) -> Result<Context::Data>
pub fn del(&self, target: Ref<'_, Context::Target>) -> Result<Context::Data>
epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)
—Removes an element in
this Epoll
.
This also returns the owning Data
.
sourcepub fn wait<'context>(
&'context self,
event_list: &mut EventVec<'context, Context>,
timeout: c_int
) -> Result<()>
pub fn wait<'context>(
&'context self,
event_list: &mut EventVec<'context, Context>,
timeout: c_int
) -> 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§
source§impl<'context, T: AsFd + IntoFd + FromFd> AsFd for Epoll<Owning<'context, T>>
impl<'context, T: AsFd + IntoFd + FromFd> AsFd for Epoll<Owning<'context, T>>
source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Auto Trait Implementations§
impl<Context> RefUnwindSafe for Epoll<Context>where
Context: RefUnwindSafe,
impl<Context> Send for Epoll<Context>where
Context: Send,
impl<Context> Sync for Epoll<Context>where
Context: Sync,
impl<Context> Unpin for Epoll<Context>where
Context: Unpin,
impl<Context> UnwindSafe for Epoll<Context>where
Context: UnwindSafe,
Blanket Implementations§
source§impl<T> AsFilelike for Twhere
T: AsFd,
impl<T> AsFilelike for Twhere
T: AsFd,
source§fn as_filelike(&self) -> BorrowedFd<'_>
fn as_filelike(&self) -> BorrowedFd<'_>
source§fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target>where
Target: FilelikeViewType,
fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target>where
Target: FilelikeViewType,
&Target
. Read moresource§impl<T> AsRawFilelike for Twhere
T: AsRawFd,
impl<T> AsRawFilelike for Twhere
T: AsRawFd,
source§fn as_raw_filelike(&self) -> i32
fn as_raw_filelike(&self) -> i32
source§impl<T> AsRawSocketlike for Twhere
T: AsRawFd,
impl<T> AsRawSocketlike for Twhere
T: AsRawFd,
source§fn as_raw_socketlike(&self) -> i32
fn as_raw_socketlike(&self) -> i32
source§impl<T> AsSocketlike for Twhere
T: AsFd,
impl<T> AsSocketlike for Twhere
T: AsFd,
source§fn as_socketlike(&self) -> BorrowedFd<'_>
fn as_socketlike(&self) -> BorrowedFd<'_>
source§fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
&Target
. Read moresource§impl<T> FromRawFilelike for Twhere
T: FromRawFd,
impl<T> FromRawFilelike for Twhere
T: FromRawFd,
source§unsafe fn from_raw_filelike(raw: i32) -> T
unsafe fn from_raw_filelike(raw: i32) -> T
Self
from the raw value. Read moresource§impl<T> FromRawSocketlike for Twhere
T: FromRawFd,
impl<T> FromRawSocketlike for Twhere
T: FromRawFd,
source§unsafe fn from_raw_socketlike(raw: i32) -> T
unsafe fn from_raw_socketlike(raw: i32) -> T
Self
from the raw value. Read more