Rename Gen to Coro in tests

This commit is contained in:
Oli Scherer 2023-10-20 09:45:18 +00:00
parent 2d91c76d5d
commit 82ffd58bfb
3 changed files with 12 additions and 12 deletions

View File

@ -10,18 +10,18 @@
use std::ops::Coroutine;
pub trait CoroutineProviderAlt: Sized {
type Gen: Coroutine<(), Return = (), Yield = ()>;
type Coro: Coroutine<(), Return = (), Yield = ()>;
fn start(ctx: Context<Self>) -> Self::Gen;
fn start(ctx: Context<Self>) -> Self::Coro;
}
pub struct Context<G: 'static + CoroutineProviderAlt> {
pub link: Box<G::Gen>,
pub link: Box<G::Coro>,
}
impl CoroutineProviderAlt for () {
type Gen = impl Coroutine<(), Return = (), Yield = ()>;
fn start(ctx: Context<Self>) -> Self::Gen {
type Coro = impl Coroutine<(), Return = (), Yield = ()>;
fn start(ctx: Context<Self>) -> Self::Coro {
move || {
match ctx {
_ => (),

View File

@ -6,9 +6,9 @@
mod gen {
use std::ops::Coroutine;
pub type GenOnce<Y, R> = impl Coroutine<Yield = Y, Return = R>;
pub type CoroOnce<Y, R> = impl Coroutine<Yield = Y, Return = R>;
pub const fn const_coroutine<Y, R>(yielding: Y, returning: R) -> GenOnce<Y, R> {
pub const fn const_coroutine<Y, R>(yielding: Y, returning: R) -> CoroOnce<Y, R> {
move || {
yield yielding;
@ -17,6 +17,6 @@ mod gen {
}
}
const FOO: gen::GenOnce<usize, usize> = gen::const_coroutine(10, 100);
const FOO: gen::CoroOnce<usize, usize> = gen::const_coroutine(10, 100);
fn main() {}

View File

@ -2,17 +2,17 @@
use std::ops::Coroutine;
trait Runnable {
type Gen: Coroutine<Yield = (), Return = ()>;
type Coro: Coroutine<Yield = (), Return = ()>;
fn run(&mut self) -> Self::Gen;
fn run(&mut self) -> Self::Coro;
}
struct Implementor {}
impl Runnable for Implementor {
type Gen = impl Coroutine<Yield = (), Return = ()>;
type Coro = impl Coroutine<Yield = (), Return = ()>;
fn run(&mut self) -> Self::Gen {
fn run(&mut self) -> Self::Coro {
//~^ ERROR: type mismatch resolving
move || {
yield 1;