[−][src]Struct event_manager::Events
Wrapper over an epoll::EpollEvent
object.
When working directly with epoll related methods, the user associates an u64
wide
epoll_data_t object with every event. We want to use fds as identifiers, but at the same time
keep the ability to associate opaque data with an event. An Events
object always contains an
fd and an u32
data member that can be supplied by the user. When registering events with the
inner epoll event set, the fd and data members of Events
as used together to generate the
underlying u64
member of the epoll_data union.
Implementations
impl Events
[src]
pub fn empty<T: AsRawFd>(source: &T) -> Self
[src]
Create an empty event set associated with source
.
No explicit events are monitored for the associated file descriptor.
Nevertheless, EventSet::ERROR
and
EventSet::HANG_UP
are implicitly
monitored.
Arguments
- source: object that wraps a file descriptor to be associated with
events
Example
let eventfd = EventFd::new(0).unwrap(); let ev_set = Events::empty(&eventfd);
pub fn empty_raw(fd: RawFd) -> Self
[src]
Create an empty event set associated with the supplied RawFd
value.
No explicit events are monitored for the associated file descriptor.
Nevertheless, EventSet::ERROR
and
EventSet::HANG_UP
are implicitly
monitored.
Example
let eventfd = EventFd::new(0).unwrap(); let ev_set = Events::empty_raw(eventfd.as_raw_fd());
pub fn new<T: AsRawFd>(source: &T, events: EventSet) -> Self
[src]
Create an event with source
and the associated events
for monitoring.
Arguments
- source: object that wraps a file descriptor to be associated with
events
- events: events to monitor on the provided
source
;EventSet::ERROR
andEventSet::HANG_UP
are always monitored and don't need to be explicitly added to the list.
Example
let eventfd = EventFd::new(0).unwrap(); let event_set = EventSet::IN; let ev_set = Events::new(&eventfd, event_set);
pub fn new_raw(source: RawFd, events: EventSet) -> Self
[src]
Create an event with the supplied RawFd
value and events
for monitoring.
Arguments
- source: file descriptor on which to monitor the
events
- events: events to monitor on the provided
source
;EventSet::ERROR
andEventSet::HANG_UP
are always monitored and don't need to be explicitly added to the list.
Example
let eventfd = EventFd::new(0).unwrap(); let event_set = EventSet::IN; let ev_set = Events::new_raw(eventfd.as_raw_fd(), event_set);
pub fn with_data<T: AsRawFd>(source: &T, data: u32, events: EventSet) -> Self
[src]
Create an event set associated with the underlying file descriptor of the source, active events, and data.
Arguments
- source: object that wraps a file descriptor to be associated with
events
- data: custom user data associated with the file descriptor; the data can be used for uniquely identify monitored events instead of using the file descriptor.
- events: events to monitor on the provided
source
;EventSet::ERROR
andEventSet::HANG_UP
are always monitored and don't need to be explicitly added to the list.
Examples
let eventfd = EventFd::new(0).unwrap(); let event_set = EventSet::IN; let custom_data = 42; let ev_set = Events::with_data(&eventfd, custom_data, event_set);
pub fn with_data_raw(source: RawFd, data: u32, events: EventSet) -> Self
[src]
Create an event set associated with the supplied RawFd
value, active events, and data.
Arguments
- source: file descriptor to be associated with
events
- data: custom user data associated with the file descriptor; the data can be used for uniquely identify monitored events instead of using the file descriptor.
- events: events to monitor on the provided
source
;EventSet::ERROR
andEventSet::HANG_UP
are always monitored and don't need to be explicitly added to the list.
Examples
let eventfd = EventFd::new(0).unwrap(); let event_set = EventSet::IN; let custom_data = 42; let ev_set = Events::with_data_raw(eventfd.as_raw_fd(), custom_data, event_set);
pub fn fd(&self) -> RawFd
[src]
Return the inner fd value.
pub fn data(&self) -> u32
[src]
Return the inner data value.
pub fn event_set(&self) -> EventSet
[src]
Return the active event set.
pub fn epoll_event(&self) -> EpollEvent
[src]
Return the inner EpollEvent
.
Trait Implementations
impl Clone for Events
[src]
impl Copy for Events
[src]
impl Debug for Events
[src]
impl PartialEq<Events> for Events
[src]
Auto Trait Implementations
impl RefUnwindSafe for Events
impl Send for Events
impl Sync for Events
impl Unpin for Events
impl UnwindSafe for Events
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,