struct SharedPollState {
    state: Arc<AtomicU8>,
}
Expand description

Internal polling state of the stream.

Fields§

§state: Arc<AtomicU8>

Implementations§

source§

impl SharedPollState

source

fn new(value: u8) -> SharedPollState

Constructs new SharedPollState with the given state.

source

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.

source

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.

source

fn stop_polling(&self, to_poll: u8, will_be_woken: bool) -> u8

Sets current state to

  • !POLLING allowing to use wakers
  • WOKEN if the state was changed during POLLING phase as waker will be called, or will_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.
source

fn stop_waking(&self) -> u8

Toggles state to non-waking, allowing to start polling.

source

fn reset(&self) -> u8

Resets current state allowing to poll the stream and wake up wakers.

Trait Implementations§

source§

impl Clone for SharedPollState

source§

fn clone(&self) -> SharedPollState

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SharedPollState

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.