From 637c9b4e89f9b110540329a107bf1b9b85d936fe Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Thu, 3 Oct 2024 09:36:11 -0400 Subject: [PATCH 1/3] Document how `BoxFuture`s are often made --- futures-core/src/future.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/futures-core/src/future.rs b/futures-core/src/future.rs index 7540cd027e..59d29ebef5 100644 --- a/futures-core/src/future.rs +++ b/futures-core/src/future.rs @@ -9,6 +9,11 @@ pub use core::future::Future; /// An owned dynamically typed [`Future`] for use in cases where you can't /// statically type your result or need to add some indirection. +/// +/// This type is often created by the [`boxed`] method on [`FutureExt`]. See its documentation for more. +/// +/// [`boxed`]: https://docs.rs/futures/latest/futures/future/trait.FutureExt.html#method.boxed +/// [`FutureExt`]: https://docs.rs/futures/latest/futures/future/trait.FutureExt.html #[cfg(feature = "alloc")] pub type BoxFuture<'a, T> = Pin + Send + 'a>>; From a4003d0f6b225b50f7cf6ad66115b4df88372398 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Thu, 3 Oct 2024 16:27:55 -0400 Subject: [PATCH 2/3] Add doc pointer for `FutureExt::boxed_local` --- futures-core/src/future.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/futures-core/src/future.rs b/futures-core/src/future.rs index 59d29ebef5..30c0323a6b 100644 --- a/futures-core/src/future.rs +++ b/futures-core/src/future.rs @@ -18,6 +18,11 @@ pub use core::future::Future; pub type BoxFuture<'a, T> = Pin + Send + 'a>>; /// `BoxFuture`, but without the `Send` requirement. +/// +/// This type is often created by the [`boxed_local`] method on [`FutureExt`]. See its documentation for more. +/// +/// [`boxed_local`]: https://docs.rs/futures/latest/futures/future/trait.FutureExt.html#method.boxed_local +/// [`FutureExt`]: https://docs.rs/futures/latest/futures/future/trait.FutureExt.html #[cfg(feature = "alloc")] pub type LocalBoxFuture<'a, T> = Pin + 'a>>; From 3623bf4ce466628c3ec12a78634bb87d0f2f155b Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Thu, 3 Oct 2024 16:31:40 -0400 Subject: [PATCH 3/3] Add documentation for BoxStream and LocalBoxStream --- futures-core/src/stream.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/futures-core/src/stream.rs b/futures-core/src/stream.rs index 19114e7dab..dd07d5aa01 100644 --- a/futures-core/src/stream.rs +++ b/futures-core/src/stream.rs @@ -6,10 +6,20 @@ use core::task::{Context, Poll}; /// An owned dynamically typed [`Stream`] for use in cases where you can't /// statically type your result or need to add some indirection. +/// +/// This type is often created by the [`boxed`] method on [`StreamExt`]. See its documentation for more. +/// +/// [`boxed`]: https://docs.rs/futures/latest/futures/stream/trait.StreamExt.html#method.boxed +/// [`StreamExt`]: https://docs.rs/futures/latest/futures/stream/trait.StreamExt.html #[cfg(feature = "alloc")] pub type BoxStream<'a, T> = Pin + Send + 'a>>; /// `BoxStream`, but without the `Send` requirement. +/// +/// This type is often created by the [`boxed_local`] method on [`StreamExt`]. See its documentation for more. +/// +/// [`boxed_local`]: https://docs.rs/futures/latest/futures/stream/trait.StreamExt.html#method.boxed_local +/// [`StreamExt`]: https://docs.rs/futures/latest/futures/stream/trait.StreamExt.html #[cfg(feature = "alloc")] pub type LocalBoxStream<'a, T> = Pin + 'a>>;