Struct wait_guard::WaitGuard
source · pub struct WaitGuard { /* private fields */ }
Expand description
An object that holds a blocked Task
that will be automatically unblocked
upon drop.
Implementations§
source§impl WaitGuard
impl WaitGuard
sourcepub fn new(task: TaskRef) -> Result<Self, RunState>
pub fn new(task: TaskRef) -> Result<Self, RunState>
Blocks the given Task
and returns a new WaitGuard
object that will
automatically unblock that Task when it is dropped.
Returns an error if the task cannot be blocked; see
[task::Task::block
] for more details.
sourcepub fn block_again(&self) -> Result<RunState, RunState>
pub fn block_again(&self) -> Result<RunState, RunState>
Blocks the task guarded by this guard, which is useful to re-block a task after it spuriously woken up.
Returns an error if the task cannot be blocked; see
[task::Task::block
] for more details.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for WaitGuard
impl Send for WaitGuard
impl Sync for WaitGuard
impl Unpin for WaitGuard
impl !UnwindSafe for WaitGuard
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