pub struct PreemptiveGuard { /* private fields */ }Expand description
RAII guard holding one unit of a PreemptiveResource.
Dropping the guard releases the unit (waking the next waiter) unless the unit was already preempted, in which case the drop is a no-op — the unit has already been handed to the preemptor.
Implementations§
Source§impl PreemptiveGuard
impl PreemptiveGuard
Sourcepub fn preempted(&self) -> EventAwaitable ⓘ
pub fn preempted(&self) -> EventAwaitable ⓘ
A future that resolves when this unit is preempted by a higher-priority
request. Intended for racing against the holder’s work, e.g.
any_of![env.timeout(d), guard.preempted()].
Resolves immediately if preemption has already happened.
Sourcepub fn is_preempted(&self) -> bool
pub fn is_preempted(&self) -> bool
Synchronously report whether this unit has been preempted. Check this after a race to decide whether to abandon the work.
Trait Implementations§
Source§impl Debug for PreemptiveGuard
impl Debug for PreemptiveGuard
Source§impl Drop for PreemptiveGuard
impl Drop for PreemptiveGuard
Auto Trait Implementations§
impl !RefUnwindSafe for PreemptiveGuard
impl !Send for PreemptiveGuard
impl !Sync for PreemptiveGuard
impl !UnwindSafe for PreemptiveGuard
impl Freeze for PreemptiveGuard
impl Unpin for PreemptiveGuard
impl UnsafeUnpin for PreemptiveGuard
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more