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>>

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<()>

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<()>

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> AsFd for Epoll<Owning<'context, T>>
fn as_fd(&Self) -> BorrowedFd<'_>
impl<'context, T: AsFd + IntoFd + FromFd> AsRawFd for Epoll<Owning<'context, T>>
fn as_raw_fd(&Self) -> RawFd
impl<'context, T: AsFd + IntoFd + FromFd> From<Epoll<Owning<'context, T>>> for OwnedFd
fn from(epoll: Epoll<Owning<'context, T>>) -> OwnedFd
impl<'context, T: AsFd + IntoFd + FromFd> From<OwnedFd> for Epoll<Owning<'context, T>>
fn from(fd: OwnedFd) -> Self
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> 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

impl<T> Any for T
where
    T: 'static + ?Sized,
fn type_id(&Self) -> TypeId
impl<T> AsFilelike for T
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,
fn as_raw_filelike(&Self) -> i32
impl<T> AsRawSocketlike for T
where
    T: AsRawFd,
fn as_raw_socketlike(&Self) -> i32
impl<T> AsSocketlike for T
where
    T: AsFd,
fn as_socketlike(&Self) -> BorrowedFd<'_>
fn as_socketlike_view<Target>(&Self) -> FilelikeView<'_, Target>
where
    Target: FromSocketlike + IntoSocketlike
impl<T> Borrow<T> for T
where
    T: ?Sized,
fn borrow(&Self) -> &T
impl<T> BorrowMut<T> for T
where
    T: ?Sized,
fn borrow_mut(&mut Self) -> &mut T
impl<T> From<T> for T
fn from(t: T) -> T

Returns the argument unchanged.

impl<T> FromRawFilelike for T
where
    T: FromRawFd,
unsafe fn from_raw_filelike(raw: i32) -> T
impl<T> FromRawSocketlike for T
where
    T: FromRawFd,
unsafe fn from_raw_socketlike(raw: i32) -> T
impl<T, U> Into<U> for T
where
    U: From<T>,
fn into(Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T> IntoRawFilelike for T
where
    T: IntoRawFd,
fn into_raw_filelike(Self) -> i32
impl<T, U> TryFrom<U> for T
where
    U: Into<T>,
type Error = Infallible
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for T
where
    U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn try_into(Self) -> Result<U, <U as TryFrom<T>>::Error>