diff options
| author | Adam Simpkins <[email protected]> | 2024-04-09 11:00:44 -0700 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2024-04-14 22:30:14 +0200 |
| commit | 5178c24cf4b0fcf4ac25f76b5456cf96e745a2be (patch) | |
| tree | cd5eae8dbc5dcb0790dfb20fada6c99c490c701c /embassy-futures/src | |
| parent | 2f5023f4a725cba2b3d34c4b23ab5781c556b49c (diff) | |
Fix embassy-futures test failure
Running `cargo test` in embassy-futures was failing. The `no_run` tag
on this doc example caused it to still try and compile this example,
just not run it, and compilation failed. This updates the example so
that it can successfully compile and run.
Diffstat (limited to 'embassy-futures/src')
| -rw-r--r-- | embassy-futures/src/yield_now.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/embassy-futures/src/yield_now.rs b/embassy-futures/src/yield_now.rs index bb3c67d17..4d4e535f2 100644 --- a/embassy-futures/src/yield_now.rs +++ b/embassy-futures/src/yield_now.rs | |||
| @@ -9,10 +9,16 @@ use core::task::{Context, Poll}; | |||
| 9 | /// hold, while still allowing other tasks to run concurrently (not monopolizing | 9 | /// hold, while still allowing other tasks to run concurrently (not monopolizing |
| 10 | /// the executor thread). | 10 | /// the executor thread). |
| 11 | /// | 11 | /// |
| 12 | /// ```rust,no_run | 12 | /// ```rust |
| 13 | /// # use embassy_futures::{block_on, yield_now}; | ||
| 14 | /// # async fn test_fn() { | ||
| 15 | /// # let mut iter_count: u32 = 0; | ||
| 16 | /// # let mut some_condition = || { iter_count += 1; iter_count > 10 }; | ||
| 13 | /// while !some_condition() { | 17 | /// while !some_condition() { |
| 14 | /// yield_now().await; | 18 | /// yield_now().await; |
| 15 | /// } | 19 | /// } |
| 20 | /// # } | ||
| 21 | /// # block_on(test_fn()); | ||
| 16 | /// ``` | 22 | /// ``` |
| 17 | /// | 23 | /// |
| 18 | /// The downside is this will spin in a busy loop, using 100% of the CPU, while | 24 | /// The downside is this will spin in a busy loop, using 100% of the CPU, while |
