Skip to content

Commit cf1ea8e

Browse files
committed
Fix up trait_transformer example
1 parent 0493886 commit cf1ea8e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

trait_transformer/examples/trait_transformer.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88

9-
#![feature(async_fn_in_trait, return_position_impl_trait_in_trait, return_type_notation)]
9+
#![allow(incomplete_features)]
10+
#![feature(return_type_notation)]
11+
12+
use std::iter;
1013

1114
use trait_transformer::trait_transformer;
1215

@@ -18,27 +21,28 @@ trait IntFactory {
1821
fn call(&self) -> u32;
1922
}
2023

21-
fn thing(factory: impl SendIntFactory) {
22-
tokio::task::spawn(|| async {
24+
fn thing(factory: impl SendIntFactory + 'static) {
25+
tokio::task::spawn(async move {
2326
factory.make().await;
24-
})
27+
});
2528
}
2629

2730
struct MyFactory;
2831

2932
impl IntFactory for MyFactory {
3033
async fn make(&self) -> i32 {
31-
todo!();
34+
todo!()
3235
}
3336

3437
fn stream(&self) -> impl Iterator<Item = i32> {
35-
todo!();
38+
iter::empty()
3639
}
3740

3841
fn call(&self) -> u32 {
3942
0
4043
}
4144
}
45+
impl SendIntFactory for MyFactory {}
4246

4347
fn main() {
4448
let my_factory = MyFactory;

0 commit comments

Comments
 (0)