[−][src]Struct mio::event::Event
A readiness event.
Event
is a readiness state paired with a Token
. It is returned by
Poll::poll
.
For more documentation on polling and events, see Poll
.
Implementations
impl Event
[src]
pub fn token(&self) -> Token
[src]
Returns the event's token.
pub fn is_readable(&self) -> bool
[src]
Returns true if the event contains readable readiness.
pub fn is_writable(&self) -> bool
[src]
Returns true if the event contains writable readiness.
pub fn is_error(&self) -> bool
[src]
Returns true if the event contains error readiness.
Error events occur when the socket enters an error state. In this case, the socket will also receive a readable or writable event. Reading or writing to the socket will result in an error.
Notes
Method is available on all platforms, but not all platforms trigger the error event.
The table below shows what flags are checked on what OS.
OS selector | Flag(s) checked |
---|---|
epoll | EPOLLERR |
kqueue | EV_ERROR and EV_EOF with fflags set to 0 . |
pub fn is_read_closed(&self) -> bool
[src]
Returns true if the event contains read closed readiness.
Notes
Read closed readiness can be expected after any of the following have occurred:
- The local stream has shutdown the read half of its socket
- The local stream has shutdown both the read half and the write half of its socket
- The peer stream has shutdown the write half its socket; this sends a
FIN
packet that has been received by the local stream
Method is a best effort implementation. While some platforms may not return readiness when read half is closed, it is guaranteed that false-positives will not occur.
The table below shows what flags are checked on what OS.
OS selector | Flag(s) checked |
---|---|
epoll | EPOLLHUP , or |
EPOLLIN and EPOLLRDHUP | |
kqueue | EV_EOF |
pub fn is_write_closed(&self) -> bool
[src]
Returns true if the event contains write closed readiness.
Notes
On epoll this is essentially a check for EPOLLHUP
flag as the
local stream shutting down its write half does not trigger this event.
On kqueue the local stream shutting down the write half of its socket will trigger this event.
Method is a best effort implementation. While some platforms may not return readiness when write half is closed, it is guaranteed that false-positives will not occur.
The table below shows what flags are checked on what OS.
OS selector | Flag(s) checked |
---|---|
epoll | EPOLLHUP , or |
only EPOLLERR , or | |
EPOLLOUT and EPOLLERR | |
kqueue | EV_EOF |
pub fn is_priority(&self) -> bool
[src]
Returns true if the event contains priority readiness.
Notes
Method is available on all platforms, but not all platforms trigger the priority event.
The table below shows what flags are checked on what OS.
OS selector | Flag(s) checked |
---|---|
epoll | EPOLLPRI |
kqueue | Not supported |
pub fn is_aio(&self) -> bool
[src]
Returns true if the event contains AIO readiness.
Notes
Method is available on all platforms, but not all platforms support AIO.
The table below shows what flags are checked on what OS.
OS selector | Flag(s) checked |
---|---|
epoll | Not supported |
kqueue1 | EVFILT_AIO |
1: Only supported on DragonFly BSD, FreeBSD, iOS and macOS.
pub fn is_lio(&self) -> bool
[src]
Returns true if the event contains LIO readiness.
Notes
Method is available on all platforms, but only FreeBSD supports LIO. On
FreeBSD this method checks the EVFILT_LIO
flag.
Trait Implementations
impl Clone for Event
[src]
impl Debug for Event
[src]
When the alternate flag is enabled this will print platform specific
details, for example the fields of the kevent
structure on platforms that
use kqueue(2)
. Note however that the output of this implementation is
not consider a part of the stable API.
Auto Trait Implementations
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,