2019-03-03 16:23:38 -06:00
|
|
|
// run-pass
|
|
|
|
// compile-flags: -g
|
2019-08-17 00:08:01 -05:00
|
|
|
// ignore-asmjs wasm2js does not support source maps yet
|
2019-03-03 16:23:38 -06:00
|
|
|
|
|
|
|
#![feature(generators, generator_trait)]
|
|
|
|
|
|
|
|
use std::ops::Generator;
|
|
|
|
|
|
|
|
struct Database;
|
|
|
|
|
|
|
|
impl Database {
|
|
|
|
fn get_connection(&self) -> impl Iterator<Item = ()> {
|
|
|
|
Some(()).into_iter()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn check_connection(&self) -> impl Generator<Yield = (), Return = ()> + '_ {
|
|
|
|
move || {
|
|
|
|
let iter = self.get_connection();
|
|
|
|
for i in iter {
|
|
|
|
yield i
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
Database.check_connection();
|
|
|
|
}
|