pub struct Gate { /* private fields */ }Expand description
Park until a predicate holds.
wait_until re-runs check each time the gate is notified and resolves
with the first Some it produces. The enable-before-check ordering is
internal, so a notify racing the check is never lost.
Implementations§
Source§impl Gate
impl Gate
Sourcepub fn notify(&self)
pub fn notify(&self)
Wake all parked waiters so they re-run their predicates.
Call after every state change a waiter might be watching.
Sourcepub async fn wait_until<T>(&self, check: impl FnMut() -> Option<T>) -> T
pub async fn wait_until<T>(&self, check: impl FnMut() -> Option<T>) -> T
Park until check returns Some.
Sourcepub async fn wait_until_cancellable<T>(
&self,
token: &CancelToken,
check: impl FnMut() -> Option<T>,
) -> Result<T, Cancelled>
pub async fn wait_until_cancellable<T>( &self, token: &CancelToken, check: impl FnMut() -> Option<T>, ) -> Result<T, Cancelled>
Park until check returns Some or the token is cancelled.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Gate
impl RefUnwindSafe for Gate
impl Send for Gate
impl Sync for Gate
impl Unpin for Gate
impl UnsafeUnpin for Gate
impl UnwindSafe for Gate
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