pub struct Blocker { /* private fields */ }
Expand description
A blocker that blocks until the associated waker is woken.
To obtain a Blocker
and its associated core::task::Waker
, call new_waker()
.
Blocker
will block the current task; thus, it doesn’t implement Send
or Sync
to ensure that it cannot be sent to other tasks.
Implementations§
source§impl Blocker
impl Blocker
sourcepub fn block(&self)
pub fn block(&self)
Blocks the current task by putting it to sleep until the associated waker is woken.
If the waker was already woken prior to this function being called, it will return immediately.
After this function returns, the inner state of the blocker+waker pair will have been reset to its initial “unwoken” state, enabling them to be re-used. In other words, this function can be called again, at which point it will block until the waker is woken again.
Trait Implementations§
Auto Trait Implementations§
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