Skip to main content

Changes

Struct Changes 

Source
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>

Source

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.

Source

pub const fn seen(&self) -> u32

The generation this handle has already observed.

Trait Implementations§

Source§

impl<T: Clone + 'static, const WAITERS: usize> Debug for Changes<T, WAITERS>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.