pub struct EpollEvent(/* private fields */);
Expand description
Wrapper over ‘libc::epoll_event’.
Implementations§
Source§impl EpollEvent
impl EpollEvent
Sourcepub fn new(events: EventSet, data: u64) -> Self
pub fn new(events: EventSet, data: u64) -> Self
Create a new epoll_event instance.
§Arguments
events
- contains an event mask.
data
- a user data variable. data
field can be a fd on which
we want to monitor the events specified by events
.
§Examples
extern crate vmm_sys_util;
use vmm_sys_util::epoll::{EpollEvent, EventSet};
let event = EpollEvent::new(EventSet::IN, 2);
Sourcepub fn events(&self) -> u32
pub fn events(&self) -> u32
Returns the events
from
‘libc::epoll_event’.
§Examples
extern crate vmm_sys_util;
use vmm_sys_util::epoll::{EpollEvent, EventSet};
let event = EpollEvent::new(EventSet::IN, 2);
assert_eq!(event.events(), 1);
Sourcepub fn data(&self) -> u64
pub fn data(&self) -> u64
Returns the data
from the libc::epoll_event
.
§Examples
extern crate vmm_sys_util;
use vmm_sys_util::epoll::{EpollEvent, EventSet};
let event = EpollEvent::new(EventSet::IN, 2);
assert_eq!(event.data(), 2);
Sourcepub fn fd(&self) -> RawFd
pub fn fd(&self) -> RawFd
Converts the libc::epoll_event
data to a RawFd.
This conversion is lossy when the data does not correspond to a RawFd (data does not fit in a i32).
§Examples
extern crate vmm_sys_util;
use vmm_sys_util::epoll::{EpollEvent, EventSet};
let event = EpollEvent::new(EventSet::IN, 2);
assert_eq!(event.fd(), 2);
Trait Implementations§
Source§impl Clone for EpollEvent
impl Clone for EpollEvent
Source§fn clone(&self) -> EpollEvent
fn clone(&self) -> EpollEvent
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for EpollEvent
impl Debug for EpollEvent
Source§impl Default for EpollEvent
impl Default for EpollEvent
Source§impl Deref for EpollEvent
impl Deref for EpollEvent
impl Copy for EpollEvent
Auto Trait Implementations§
impl Freeze for EpollEvent
impl RefUnwindSafe for EpollEvent
impl Send for EpollEvent
impl Sync for EpollEvent
impl Unpin for EpollEvent
impl UnwindSafe for EpollEvent
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
Mutably borrows from an owned value. Read more