We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 61e339a commit 3e19f26Copy full SHA for 3e19f26
src/future.rs
@@ -1,5 +1,9 @@
1
use futures::future::Future;
2
3
+pub async fn ready<T>(value: T) -> T {
4
+ value
5
+}
6
+
7
pub async fn map<Fut, U, F>(future: Fut, f: F) -> U
8
where F: FnOnce(Fut::Output) -> U,
9
Fut: Future,
@@ -87,6 +91,14 @@ mod tests {
87
91
use futures::{future, executor};
88
92
use crate::future::*;
89
93
94
+ #[test]
95
+ fn test_ready() {
96
+ executor::block_on(async {
97
+ let future = ready(1);
98
+ assert_eq!(await!(future), 1);
99
+ });
100
+ }
101
90
102
#[test]
103
fn test_map() {
104
executor::block_on(async {
0 commit comments