pub struct Ticket { /* private fields */ }Expand description
Position in a sequence issued by Tickets.
The oldest outstanding ticket holds the turn. Passing or dropping it hands the turn to the next ticket; a ticket dropped before its turn is skipped.
Holding a ticket blocks the turn of every later ticket of the sequence, pass or drop it once its ordered side effect is done.
A canceled ticket keeps its position: its turn wait returns Canceled and
dropping it passes or skips its turn as usual.
Implementations§
Source§impl Ticket
impl Ticket
Sourcepub fn is_canceled(&self) -> bool
pub fn is_canceled(&self) -> bool
Returns true if this ticket is canceled.
Returns false after pass().
Sourcepub fn poll_turn(&self, cx: &mut Context<'_>) -> Poll<Result<(), Canceled>>
pub fn poll_turn(&self, cx: &mut Context<'_>) -> Poll<Result<(), Canceled>>
Polls until this ticket holds the turn.
Returns Err(Canceled) if the ticket is canceled, even if it holds the turn,
or if it is passed.
Sourcepub async fn turn(&self) -> Result<(), Canceled>
pub async fn turn(&self) -> Result<(), Canceled>
Waits until this ticket holds the turn.
Returns Err(Canceled) if the ticket is canceled, even if it holds the turn,
or if it is passed.
Trait Implementations§
impl Eq for Ticket
Auto Trait Implementations§
impl !RefUnwindSafe for Ticket
impl !Send for Ticket
impl !Sync for Ticket
impl !UnwindSafe for Ticket
impl Freeze for Ticket
impl Unpin for Ticket
impl UnsafeUnpin for Ticket
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.