diff options
| author | Dániel Buga <[email protected]> | 2024-12-30 12:13:13 +0100 |
|---|---|---|
| committer | Dániel Buga <[email protected]> | 2024-12-30 12:13:13 +0100 |
| commit | 44217aa0924e7590aa0afabdf17babd5c2ea5b82 (patch) | |
| tree | e42f5d02f9b560610b870d802cf390518180c3c6 /embassy-sync/src/watch.rs | |
| parent | a4f8fddd696ca2e3705827ba4b3806cbadcb3134 (diff) | |
Desugar some async fns
Diffstat (limited to 'embassy-sync/src/watch.rs')
| -rw-r--r-- | embassy-sync/src/watch.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/embassy-sync/src/watch.rs b/embassy-sync/src/watch.rs index 404e31714..e76646c0b 100644 --- a/embassy-sync/src/watch.rs +++ b/embassy-sync/src/watch.rs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | //! A synchronization primitive for passing the latest value to **multiple** receivers. | 1 | //! A synchronization primitive for passing the latest value to **multiple** receivers. |
| 2 | 2 | ||
| 3 | use core::cell::RefCell; | 3 | use core::cell::RefCell; |
| 4 | use core::future::poll_fn; | 4 | use core::future::{poll_fn, Future}; |
| 5 | use core::marker::PhantomData; | 5 | use core::marker::PhantomData; |
| 6 | use core::ops::{Deref, DerefMut}; | 6 | use core::ops::{Deref, DerefMut}; |
| 7 | use core::task::{Context, Poll}; | 7 | use core::task::{Context, Poll}; |
| @@ -547,8 +547,8 @@ impl<'a, T: Clone, W: WatchBehavior<T> + ?Sized> Rcv<'a, T, W> { | |||
| 547 | /// Returns the current value of the `Watch` once it is initialized, marking it as seen. | 547 | /// Returns the current value of the `Watch` once it is initialized, marking it as seen. |
| 548 | /// | 548 | /// |
| 549 | /// **Note**: Futures do nothing unless you `.await` or poll them. | 549 | /// **Note**: Futures do nothing unless you `.await` or poll them. |
| 550 | pub async fn get(&mut self) -> T { | 550 | pub fn get(&mut self) -> impl Future<Output = T> + '_ { |
| 551 | poll_fn(|cx| self.watch.poll_get(&mut self.at_id, cx)).await | 551 | poll_fn(|cx| self.watch.poll_get(&mut self.at_id, cx)) |
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | /// Tries to get the current value of the `Watch` without waiting, marking it as seen. | 554 | /// Tries to get the current value of the `Watch` without waiting, marking it as seen. |
