From 2c0332925594fe051cdc517be13cd49466fcf705 Mon Sep 17 00:00:00 2001 From: tyranron Date: Wed, 29 Jan 2020 12:12:12 +0100 Subject: [PATCH 1/2] Add into_inner method for future::Ready --- futures-util/src/future/ready.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/futures-util/src/future/ready.rs b/futures-util/src/future/ready.rs index 94e6d35563..48661b3d84 100644 --- a/futures-util/src/future/ready.rs +++ b/futures-util/src/future/ready.rs @@ -7,6 +7,14 @@ use futures_core::task::{Context, Poll}; #[must_use = "futures do nothing unless you `.await` or poll them"] pub struct Ready(Option); +impl Ready { + /// Unwraps the value from this immediately ready future. + #[inline] + pub fn into_inner(mut self) -> T { + self.0.take().unwrap() + } +} + impl Unpin for Ready {} impl FusedFuture for Ready { @@ -24,7 +32,7 @@ impl Future for Ready { } } -/// Create a future that is immediately ready with a value. +/// Creates a future that is immediately ready with a value. /// /// # Examples /// From 2f999e7ed66917698f2af4757ce12d7282b88de1 Mon Sep 17 00:00:00 2001 From: tyranron Date: Wed, 29 Jan 2020 12:29:09 +0100 Subject: [PATCH 2/2] Add CHANGELOG entry --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b6a30d17c..673f7b2f8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 0.3.2 - 2020-??-?? +* Added `into_inner` method for `future::Ready` (#2055) + # 0.3.1 - 2019-11-7 * Fix signature of `LocalSpawn` trait (breaking change -- see #1959) @@ -5,7 +8,7 @@ * Stable release along with stable async/await! * Added async/await to default features (#1953) * Changed `Spawn` trait and `FuturesUnordered::push` to take `&self` (#1950) -* Moved `Spawn` and `FutureObj` out of `futures-core` and into `futures-task (#1925) +* Moved `Spawn` and `FutureObj` out of `futures-core` and into `futures-task` (#1925) * Changed case convention for feature names (#1937) * Added `executor` feature (#1949) * Moved `copy_into`/`copy_buf_into` (#1948)