Struct futures_util::stream::stream::flatten_unordered::SharedPollState
source · struct SharedPollState {
state: Arc<AtomicU8>,
}
Expand description
Internal polling state of the stream.
Fields§
§state: Arc<AtomicU8>
Implementations§
sourcefn new(value: u8) -> SharedPollState
fn new(value: u8) -> SharedPollState
Constructs new SharedPollState
with the given state.
sourcefn start_polling(
&self
) -> Option<(u8, PollStateBomb<'_, impl FnOnce(&SharedPollState) -> u8>)>
fn start_polling( &self ) -> Option<(u8, PollStateBomb<'_, impl FnOnce(&SharedPollState) -> u8>)>
Attempts to start polling, returning stored state in case of success.
Returns None
if either waker is waking at the moment.
sourcefn start_waking(
&self,
to_poll: u8
) -> Option<(u8, PollStateBomb<'_, impl FnOnce(&SharedPollState) -> u8>)>
fn start_waking( &self, to_poll: u8 ) -> Option<(u8, PollStateBomb<'_, impl FnOnce(&SharedPollState) -> u8>)>
Attempts to start the waking process and performs bitwise or with the given value.
If some waker is already in progress or stream is already woken/being polled, waking process won’t start, however state will be disjuncted with the given value.
sourcefn stop_polling(&self, to_poll: u8, will_be_woken: bool) -> u8
fn stop_polling(&self, to_poll: u8, will_be_woken: bool) -> u8
Sets current state to
!POLLING
allowing to use wakersWOKEN
if the state was changed duringPOLLING
phase as waker will be called, orwill_be_woken
flag supplied!WAKING
as- Wakers called during the
POLLING
phase won’t propagate their calls POLLING
phase can’t start if some of the wakers are active So no wrapped waker can touch the inner waker’s cell, it’s safe to poll again.
- Wakers called during the
sourcefn stop_waking(&self) -> u8
fn stop_waking(&self) -> u8
Toggles state to non-waking, allowing to start polling.
Trait Implementations§
source§fn clone(&self) -> SharedPollState
fn clone(&self) -> SharedPollState
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more