Struct async_atomic::GenericSubscriber
source · pub struct GenericSubscriber<T: Copy, D: Deref<Target = Atomic<T>>> { /* private fields */ }
Implementations§
source§impl<T: Copy, D: Deref<Target = Atomic<T>>> GenericSubscriber<T, D>
impl<T: Copy, D: Deref<Target = Atomic<T>>> GenericSubscriber<T, D>
sourcepub unsafe fn new(atomic_ref: D) -> Self
pub unsafe fn new(atomic_ref: D) -> Self
Safety
Only one subscriber allowed for an atomic value.
sourcepub fn wait<F: Fn(T) -> bool>(&mut self, pred: F) -> Wait<'_, T, F> ⓘ
pub fn wait<F: Fn(T) -> bool>(&mut self, pred: F) -> Wait<'_, T, F> ⓘ
Asynchronously wait for predicate to be true
.
sourcepub fn wait_and_update<F: Fn(T) -> Option<T>>(
&mut self,
map: F
) -> WaitAndUpdate<'_, T, F> ⓘ
pub fn wait_and_update<F: Fn(T) -> Option<T>>( &mut self, map: F ) -> WaitAndUpdate<'_, T, F> ⓘ
Asynchronously wait until map
returned Some(x)
and then store x
in atomic.
This is an asynchronous version of Atomic::fetch_update
.