diff options
| author | Peter Krull <[email protected]> | 2024-02-14 01:27:48 +0100 |
|---|---|---|
| committer | Peter Krull <[email protected]> | 2024-02-14 01:27:48 +0100 |
| commit | 2f58d1968a7310335a0dac4d947c6972a7707ed5 (patch) | |
| tree | 0c9eb3845972827e04fb6df82efd496c6e222970 /embassy-sync/src | |
| parent | 24a4379832d387754d407b77ff7aac5e55401eb3 (diff) | |
Updated formatting
Diffstat (limited to 'embassy-sync/src')
| -rw-r--r-- | embassy-sync/src/multi_signal.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/embassy-sync/src/multi_signal.rs b/embassy-sync/src/multi_signal.rs index 1481dc8f8..ff9f72f2e 100644 --- a/embassy-sync/src/multi_signal.rs +++ b/embassy-sync/src/multi_signal.rs | |||
| @@ -162,7 +162,6 @@ impl<'s, 'a, M: RawMutex, T: Clone, const N: usize> Rcv<'a, M, T, N> { | |||
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | /// Wait for a change to the value of the corresponding `MultiSignal` which matches the predicate `f`. | 164 | /// Wait for a change to the value of the corresponding `MultiSignal` which matches the predicate `f`. |
| 165 | // TODO: How do we make this work with a FnMut closure? | ||
| 166 | pub async fn changed_and<F>(&mut self, f: F) -> T | 165 | pub async fn changed_and<F>(&mut self, f: F) -> T |
| 167 | where | 166 | where |
| 168 | F: FnMut(&T) -> bool, | 167 | F: FnMut(&T) -> bool, |
| @@ -286,8 +285,13 @@ pub struct ReceiverPredFuture<'s, 'a, M: RawMutex, T: Clone, F: FnMut(&'a T) -> | |||
| 286 | predicate: F, | 285 | predicate: F, |
| 287 | } | 286 | } |
| 288 | 287 | ||
| 289 | impl<'s, 'a, M: RawMutex, T: Clone, F: FnMut(&T) -> bool, const N: usize> Unpin for ReceiverPredFuture<'s, 'a, M, T, F, N> {} | 288 | impl<'s, 'a, M: RawMutex, T: Clone, F: FnMut(&T) -> bool, const N: usize> Unpin |
| 290 | impl<'s, 'a, M: RawMutex, T: Clone, F: FnMut(&T) -> bool, const N: usize> Future for ReceiverPredFuture<'s, 'a, M, T, F, N>{ | 289 | for ReceiverPredFuture<'s, 'a, M, T, F, N> |
| 290 | { | ||
| 291 | } | ||
| 292 | impl<'s, 'a, M: RawMutex, T: Clone, F: FnMut(&T) -> bool, const N: usize> Future | ||
| 293 | for ReceiverPredFuture<'s, 'a, M, T, F, N> | ||
| 294 | { | ||
| 291 | type Output = T; | 295 | type Output = T; |
| 292 | 296 | ||
| 293 | fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { | 297 | fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { |
| @@ -318,9 +322,10 @@ impl<'s, 'a, M: RawMutex, T: Clone, F: FnMut(&T) -> bool, const N: usize> Receiv | |||
| 318 | 322 | ||
| 319 | #[cfg(test)] | 323 | #[cfg(test)] |
| 320 | mod tests { | 324 | mod tests { |
| 325 | use futures_executor::block_on; | ||
| 326 | |||
| 321 | use super::*; | 327 | use super::*; |
| 322 | use crate::blocking_mutex::raw::CriticalSectionRawMutex; | 328 | use crate::blocking_mutex::raw::CriticalSectionRawMutex; |
| 323 | use futures_executor::block_on; | ||
| 324 | 329 | ||
| 325 | #[test] | 330 | #[test] |
| 326 | fn multiple_writes() { | 331 | fn multiple_writes() { |
