mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 08:12:30 +00:00
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.
This commit is contained in:
parent
2f5023f4a7
commit
5178c24cf4
@ -9,10 +9,16 @@ use core::task::{Context, Poll};
|
|||||||
/// hold, while still allowing other tasks to run concurrently (not monopolizing
|
/// hold, while still allowing other tasks to run concurrently (not monopolizing
|
||||||
/// the executor thread).
|
/// the executor thread).
|
||||||
///
|
///
|
||||||
/// ```rust,no_run
|
/// ```rust
|
||||||
|
/// # use embassy_futures::{block_on, yield_now};
|
||||||
|
/// # async fn test_fn() {
|
||||||
|
/// # let mut iter_count: u32 = 0;
|
||||||
|
/// # let mut some_condition = || { iter_count += 1; iter_count > 10 };
|
||||||
/// while !some_condition() {
|
/// while !some_condition() {
|
||||||
/// yield_now().await;
|
/// yield_now().await;
|
||||||
/// }
|
/// }
|
||||||
|
/// # }
|
||||||
|
/// # block_on(test_fn());
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// The downside is this will spin in a busy loop, using 100% of the CPU, while
|
/// The downside is this will spin in a busy loop, using 100% of the CPU, while
|
||||||
|
Loading…
Reference in New Issue
Block a user