Struct Signal
pub struct Signal<T> { /* private fields */ }Available on crate feature
sensors only.Expand description
Custom signal struct inspired by [embassy_sync::signal::Signal] and [embassy_sync::channel::Channel].
This is meant for single-producer and single-consumer signaling.
This struct has been created for the ariel-os-sensors ecosystem.
Implementations§
§impl<T> Signal<T>
impl<T> Signal<T>
pub fn signal(&self, new: T)
pub fn signal(&self, new: T)
Signal that a new value is available and will replace the previous value if it wasn’t read.
pub fn wait(&'static self) -> ReceiveFuture<'static, T> ⓘ
pub fn wait(&'static self) -> ReceiveFuture<'static, T> ⓘ
Returns a future that will return once a value is available.
This is not meant to have multiple tasks waiting for a signal. If multiple tasks are waiting
then a signal sent with Self::signal will reach only one task at random.
pub fn clear(&self)
pub fn clear(&self)
Removes any pending value from the signal.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Signal<T>
impl<T> !RefUnwindSafe for Signal<T>
impl<T> Send for Signal<T>where
T: Send,
impl<T> Sync for Signal<T>where
T: Send,
impl<T> Unpin for Signal<T>where
T: Unpin,
impl<T> UnwindSafe for Signal<T>where
T: UnwindSafe,
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