pub struct Changes<T: Clone + 'static, const WAITERS: usize = DEFAULT_WAITERS> { /* private fields */ }Available on crate feature
async only.Expand description
A handle that resolves each time the configuration is replaced.
Runtime-agnostic, because it is a Future and nothing more: Embassy, RTIC
and a hand-written poll loop all drive it.
The configuration current when this was created counts as already seen, so
the first changed waits for the next one.
Implementations§
Source§impl<T: Clone + 'static, const WAITERS: usize> Changes<T, WAITERS>
impl<T: Clone + 'static, const WAITERS: usize> Changes<T, WAITERS>
Sourcepub fn changed(&mut self) -> impl Future<Output = T> + '_
pub fn changed(&mut self) -> impl Future<Output = T> + '_
Resolves with the configuration installed by the next change.
Changes that land while nothing is awaiting are not queued: waking up to the latest configuration is what a reader wants, and a queue would hand it stale ones first — which on a device means acting on a setting that has already been superseded.
Trait Implementations§
Auto Trait Implementations§
impl<T, const WAITERS: usize = DEFAULT_WAITERS> !RefUnwindSafe for Changes<T, WAITERS>
impl<T, const WAITERS: usize = DEFAULT_WAITERS> !UnwindSafe for Changes<T, WAITERS>
impl<T, const WAITERS: usize> Freeze for Changes<T, WAITERS>
impl<T, const WAITERS: usize> Send for Changes<T, WAITERS>where
T: Send,
impl<T, const WAITERS: usize> Sync for Changes<T, WAITERS>where
T: Send,
impl<T, const WAITERS: usize> Unpin for Changes<T, WAITERS>
impl<T, const WAITERS: usize> UnsafeUnpin for Changes<T, WAITERS>
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