Skip to content

Commit 80c51c1

Browse files
committed
Add documentation note for designed usecase
1 parent 9e25781 commit 80c51c1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

futures-util/src/future/always_ready.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ impl<T, F: Fn() -> T> Future for AlwaysReady<T, F> {
4040

4141
/// Creates a future that is always immediately ready with a value.
4242
///
43+
/// This is particularly useful in avoiding a heap allocation when an API needs [`Box<dyn Future<Output = T>>`],
44+
/// as [`AlwaysReady`] does not have to store a boolean for `is_finished`.
45+
///
4346
/// # Examples
4447
///
4548
/// ```

0 commit comments

Comments
 (0)