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
sourceimpl<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
sourceimpl<'context, T: AsFd + IntoFd + FromFd> AsFd for Epoll<Owning<'context, T>>
impl<'context, T: AsFd + IntoFd + FromFd> AsFd for Epoll<Owning<'context, T>>
sourcefn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Borrows the file descriptor. Read more
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
sourceimpl<T> AsFilelike for T where
T: AsFd,
impl<T> AsFilelike for T where
T: AsFd,
sourcefn as_filelike(&self) -> BorrowedFd<'_>
fn as_filelike(&self) -> BorrowedFd<'_>
Borrows the reference. Read more
sourcefn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target> where
Target: FilelikeViewType,
fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target> where
Target: FilelikeViewType,
Return a borrowing view of a resource which dereferences to a &Target
. Read more
sourceimpl<T> AsRawFilelike for T where
T: AsRawFd,
impl<T> AsRawFilelike for T where
T: AsRawFd,
sourcefn as_raw_filelike(&self) -> i32
fn as_raw_filelike(&self) -> i32
Returns the raw value.
sourceimpl<T> AsRawSocketlike for T where
T: AsRawFd,
impl<T> AsRawSocketlike for T where
T: AsRawFd,
sourcefn as_raw_socketlike(&self) -> i32
fn as_raw_socketlike(&self) -> i32
Returns the raw value.
sourceimpl<T> AsSocketlike for T where
T: AsFd,
impl<T> AsSocketlike for T where
T: AsFd,
sourcefn as_socketlike(&self) -> BorrowedFd<'_>
fn as_socketlike(&self) -> BorrowedFd<'_>
Borrows the reference.
sourcefn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target> where
Target: SocketlikeViewType,
fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target> where
Target: SocketlikeViewType,
Return a borrowing view of a resource which dereferences to a &Target
. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FromRawFilelike for T where
T: FromRawFd,
impl<T> FromRawFilelike for T where
T: FromRawFd,
sourceunsafe fn from_raw_filelike(raw: i32) -> T
unsafe fn from_raw_filelike(raw: i32) -> T
Constructs Self
from the raw value. Read more
sourceimpl<T> FromRawSocketlike for T where
T: FromRawFd,
impl<T> FromRawSocketlike for T where
T: FromRawFd,
sourceunsafe fn from_raw_socketlike(raw: i32) -> T
unsafe fn from_raw_socketlike(raw: i32) -> T
Constructs Self
from the raw value. Read more
sourceimpl<T> IntoRawFilelike for T where
T: IntoRawFd,
impl<T> IntoRawFilelike for T where
T: IntoRawFd,
sourcefn into_raw_filelike(self) -> i32
fn into_raw_filelike(self) -> i32
Returns the raw value.
sourceimpl<T> IntoRawSocketlike for T where
T: IntoRawFd,
impl<T> IntoRawSocketlike for T where
T: IntoRawFd,
sourcefn into_raw_socketlike(self) -> i32
fn into_raw_socketlike(self) -> i32
Returns the raw value.