File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,30 @@ impl<T> Future for Ready<T> {
2424 }
2525}
2626
27+ impl < T > Ready < T > {
28+ /// Consumes the `Ready`, returning the wrapped value.
29+ ///
30+ /// # Panics
31+ ///
32+ /// Will panic if this [`Ready`] was already polled to completion.
33+ ///
34+ /// # Examples
35+ ///
36+ /// ```
37+ /// #![feature(ready_into_inner)]
38+ /// use std::future;
39+ ///
40+ /// let a = future::ready(1);
41+ /// assert_eq!(a.into_inner(), 1);
42+ /// ```
43+ #[ unstable( feature = "ready_into_inner" , issue = "101196" ) ]
44+ #[ must_use]
45+ #[ inline]
46+ pub fn into_inner ( self ) -> T {
47+ self . 0 . expect ( "Called `into_inner()` on `Ready` after completion" )
48+ }
49+ }
50+
2751/// Creates a future that is immediately ready with a value.
2852///
2953/// Futures created through this function are functionally similar to those
You can’t perform that action at this time.
0 commit comments