[−][src]Struct mio::Events
A collection of readiness events.
Events
is passed as an argument to Poll::poll
and will be used to
receive any new readiness events received since the last poll. Usually, a
single Events
instance is created at the same time as a Poll
and
reused on each call to Poll::poll
.
See Poll
for more documentation on polling.
Examples
use mio::{Events, Poll}; use std::time::Duration; let mut events = Events::with_capacity(1024); let poll = Poll::new()?; assert_eq!(0, events.len()); // Register `Evented` handles with `poll` poll.poll(&mut events, Some(Duration::from_millis(100)))?; for event in &events { println!("event={:?}", event); }
Methods
impl Events
[src]
impl Events
pub fn with_capacity(capacity: usize) -> Events
[src]
pub fn with_capacity(capacity: usize) -> Events
Return a new Events
capable of holding up to capacity
events.
Examples
use mio::Events; let events = Events::with_capacity(1024); assert_eq!(1024, events.capacity());
pub fn capacity(&self) -> usize
[src]
pub fn capacity(&self) -> usize
Returns the number of Event
values that self
can hold.
use mio::Events; let events = Events::with_capacity(1024); assert_eq!(1024, events.capacity());
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true
if self
contains no Event
values.
Examples
use mio::Events; let events = Events::with_capacity(1024); assert!(events.is_empty());
ⓘImportant traits for Iter<'a>pub fn iter(&self) -> Iter
[src]
pub fn iter(&self) -> Iter
Returns an iterator over the Event
values.
Examples
use mio::{Events, Poll}; use std::time::Duration; let mut events = Events::with_capacity(1024); let poll = Poll::new()?; // Register handles with `poll` poll.poll(&mut events, Some(Duration::from_millis(100)))?; for event in events.iter() { println!("event={:?}", event); }
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Clearing all Event
values from container explicitly.
Examples
use mio::{Events, Poll}; use std::time::Duration; let mut events = Events::with_capacity(1024); let poll = Poll::new()?; // Register handles with `poll` for _ in 0..2 { events.clear(); poll.poll(&mut events, Some(Duration::from_millis(100)))?; for event in events.iter() { println!("event={:?}", event); } }
Trait Implementations
impl<'a> IntoIterator for &'a Events
[src]
impl<'a> IntoIterator for &'a Events
type Item = Event
The type of the elements being iterated over.
type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl IntoIterator for Events
[src]
impl IntoIterator for Events
type Item = Event
The type of the elements being iterated over.
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl Debug for Events
[src]
impl Debug for Events
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<I> IntoIterator for I where
I: Iterator,
[src]
impl<I> IntoIterator for I where
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
fn into_iter(self) -> I
Creates an iterator from a value. Read more
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
ⓘImportant traits for &'a mut Wfn borrow(&self) -> &T
[src]
fn borrow(&self) -> &T
Immutably borrows from an owned value. Read more
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
ⓘImportant traits for &'a mut Wfn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more