embassy_sync::watch

Trait WatchBehavior

Source
pub trait WatchBehavior<T: Clone>: SealedWatchBehavior<T> {
    // Required methods
    fn try_get(&self, id: Option<&mut u64>) -> Option<T>;
    fn try_get_and(
        &self,
        id: Option<&mut u64>,
        f: &mut dyn Fn(&T) -> bool,
    ) -> Option<T>;
    fn contains_value(&self) -> bool;
}
Expand description

A trait representing the ‘inner’ behavior of the Watch.

Required Methods§

Source

fn try_get(&self, id: Option<&mut u64>) -> Option<T>

Tries to get the value of the Watch, marking it as seen, if an id is given.

Source

fn try_get_and( &self, id: Option<&mut u64>, f: &mut dyn Fn(&T) -> bool, ) -> Option<T>

Tries to get the value of the Watch if it matches the predicate function f, marking it as seen.

Source

fn contains_value(&self) -> bool

Checks if the Watch is been initialized with a value.

Implementors§

Source§

impl<M: RawMutex, T: Clone, const N: usize> WatchBehavior<T> for Watch<M, T, N>