about summary refs log tree commit diff
path: root/example/polymorphize_coroutine.rs
blob: 407da94c0f092c25efad945bf64408b6bcdb2424 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]

use std::ops::Coroutine;
use std::pin::Pin;

fn main() {
    run_coroutine::<i32>();
}

fn run_coroutine<T>() {
    let mut coroutine = #[coroutine]
    || {
        yield;
        return;
    };
    Pin::new(&mut coroutine).resume(());
}