[−][src]Struct mio::SetReadiness
Updates the readiness state of the associated Registration
.
See Registration
for more documentation on using SetReadiness
and
Poll
for high level polling documentation.
Methods
impl SetReadiness
[src]
[−]
impl SetReadiness
pub fn readiness(&self) -> Ready
[src]
[−]
pub fn readiness(&self) -> Ready
Returns the registration's current readiness.
Note
There is no guarantee that readiness
establishes any sort of memory
ordering. Any concurrent data access must be synchronized using another
strategy.
Examples
use mio::{Registration, Ready}; let (registration, set_readiness) = Registration::new2(); assert!(set_readiness.readiness().is_empty()); set_readiness.set_readiness(Ready::readable())?; assert!(set_readiness.readiness().is_readable());
pub fn set_readiness(&self, ready: Ready) -> Result<()>
[src]
[−]
pub fn set_readiness(&self, ready: Ready) -> Result<()>
Set the registration's readiness
If the associated Registration
is registered with a Poll
instance
and has requested readiness events that include ready
, then a future
call to Poll::poll
will receive a readiness event representing the
readiness state change.
Note
There is no guarantee that readiness
establishes any sort of memory
ordering. Any concurrent data access must be synchronized using another
strategy.
There is also no guarantee as to when the readiness event will be delivered to poll. A best attempt will be made to make the delivery in a "timely" fashion. For example, the following is not guaranteed to work:
use mio::{Events, Registration, Ready, Poll, PollOpt, Token}; let poll = Poll::new()?; let (registration, set_readiness) = Registration::new2(); poll.register(®istration, Token(0), Ready::readable(), PollOpt::edge())?; // Set the readiness, then immediately poll to try to get the readiness // event set_readiness.set_readiness(Ready::readable())?; let mut events = Events::with_capacity(1024); poll.poll(&mut events, None)?; // There is NO guarantee that the following will work. It is possible // that the readiness event will be delivered at a later time. let event = events.get(0).unwrap(); assert_eq!(event.token(), Token(0)); assert!(event.readiness().is_readable());
Examples
A simple example, for a more elaborate example, see the Evented
documentation.
use mio::{Registration, Ready}; let (registration, set_readiness) = Registration::new2(); assert!(set_readiness.readiness().is_empty()); set_readiness.set_readiness(Ready::readable())?; assert!(set_readiness.readiness().is_readable());
Trait Implementations
impl Sync for SetReadiness
[src]
impl Sync for SetReadiness
impl Send for SetReadiness
[src]
impl Send for SetReadiness
impl Clone for SetReadiness
[src]
[+]
impl Clone for SetReadiness
impl Debug for SetReadiness
[src]
[+]
impl Debug for SetReadiness
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> ToOwned for T where
T: Clone,
[src]
[−]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
[−]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
[−]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> From for T
[src]
[−]
impl<T> From for T
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