1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// This file is part of helpers4.
// Copyright (C) 2025 baxyz
// SPDX-License-Identifier: LGPL-3.0-or-later
use Future;
use Poll;
/// A future that gives other tasks a turn: it is pending once, then completes.
///
/// The first poll wakes the task straight away and returns `Pending`, so an executor that runs
/// many tasks can schedule the others before resuming this one. Call it inside a long
/// computation in an `async` block to keep it from monopolising its thread.
///
/// # Returns
///
/// A future that completes on its second poll.
///
/// # Examples
///
/// ```
/// use helpers4::future::{block_on, yield_now};
///
/// block_on(async {
/// yield_now().await;
/// });
/// ```