2019-03-04 11:23:38 +13:00
|
|
|
// run-pass
|
|
|
|
// compile-flags: -g
|
2019-08-16 22:08:01 -07:00
|
|
|
// ignore-asmjs wasm2js does not support source maps yet
|
2019-03-04 11:23:38 +13:00
|
|
|
|
2023-10-19 21:46:28 +00:00
|
|
|
#![feature(coroutines, coroutine_trait)]
|
2019-03-04 11:23:38 +13:00
|
|
|
|
2023-10-19 16:06:43 +00:00
|
|
|
use std::ops::Coroutine;
|
2019-03-04 11:23:38 +13:00
|
|
|
|
|
|
|
struct Database;
|
|
|
|
|
|
|
|
impl Database {
|
|
|
|
fn get_connection(&self) -> impl Iterator<Item = ()> {
|
|
|
|
Some(()).into_iter()
|
|
|
|
}
|
|
|
|
|
2023-10-19 16:06:43 +00:00
|
|
|
fn check_connection(&self) -> impl Coroutine<Yield = (), Return = ()> + '_ {
|
2019-03-04 11:23:38 +13:00
|
|
|
move || {
|
|
|
|
let iter = self.get_connection();
|
|
|
|
for i in iter {
|
|
|
|
yield i
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
Database.check_connection();
|
|
|
|
}
|