pub struct SetReadiness { /* fields omitted */ }
Updates the readiness state of the associated Registration
.
See Registration
for more documentation on using SetReadiness
and
Poll
for high level polling documentation.
Returns the registration's current readiness.
There is no guarantee that readiness
establishes any sort of memory
ordering. Any concurrent data access must be synchronized using another
strategy.
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());
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.
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_readiness.set_readiness(Ready::readable())?;
let mut events = Events::with_capacity(1024);
poll.poll(&mut events, None)?;
let event = events.get(0).unwrap();
assert_eq!(event.token(), Token(0));
assert!(event.readiness().is_readable());
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());
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static