pub struct PollFd<'fd> { /* private fields */ }poll only.Expand description
This is a wrapper around libc::pollfd.
It’s meant to be used as an argument to the poll and
ppoll functions to specify the events of interest
for a specific file descriptor.
After a call to poll or ppoll, the events that occurred can be retrieved by calling
revents() on the PollFd object from the array passed to poll.
Implementations§
Source§impl<'fd> PollFd<'fd>
impl<'fd> PollFd<'fd>
Sourcepub fn new(fd: BorrowedFd<'fd>, events: PollFlags) -> PollFd<'fd>
pub fn new(fd: BorrowedFd<'fd>, events: PollFlags) -> PollFd<'fd>
Sourcepub fn revents(&self) -> Option<PollFlags>
pub fn revents(&self) -> Option<PollFlags>
Returns the events that occurred in the last call to poll or ppoll. Will only return
None if the kernel provides status flags that Nix does not know about.
Sourcepub fn any(&self) -> Option<bool>
pub fn any(&self) -> Option<bool>
Returns if any of the events of interest occured in the last call to poll or ppoll. Will
only return None if the kernel provides status flags that Nix does not know about.
Equivalent to x.revents()? != PollFlags::empty().
This is marginally more efficient than PollFd::all.
Sourcepub fn all(&self) -> Option<bool>
pub fn all(&self) -> Option<bool>
Returns if all the events of interest occured in the last call to poll or ppoll. Will
only return None if the kernel provides status flags that Nix does not know about.
Equivalent to x.revents()? & x.events() == x.events().
This is marginally less efficient than PollFd::any.
Sourcepub fn set_events(&mut self, events: PollFlags)
pub fn set_events(&mut self, events: PollFlags)
Modify the events of interest for this PollFd.
Trait Implementations§
Source§impl AsFd for PollFd<'_>
impl AsFd for PollFd<'_>
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
impl<'fd> Eq for PollFd<'fd>
impl<'fd> StructuralPartialEq for PollFd<'fd>
Auto Trait Implementations§
impl<'fd> Freeze for PollFd<'fd>
impl<'fd> RefUnwindSafe for PollFd<'fd>
impl<'fd> Send for PollFd<'fd>
impl<'fd> Sync for PollFd<'fd>
impl<'fd> Unpin for PollFd<'fd>
impl<'fd> UnwindSafe for PollFd<'fd>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes