mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-03 18:43:38 +00:00
Rename Gen
to Coro
in tests
This commit is contained in:
parent
2d91c76d5d
commit
82ffd58bfb
@ -10,18 +10,18 @@
|
|||||||
use std::ops::Coroutine;
|
use std::ops::Coroutine;
|
||||||
|
|
||||||
pub trait CoroutineProviderAlt: Sized {
|
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 struct Context<G: 'static + CoroutineProviderAlt> {
|
||||||
pub link: Box<G::Gen>,
|
pub link: Box<G::Coro>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CoroutineProviderAlt for () {
|
impl CoroutineProviderAlt for () {
|
||||||
type Gen = impl Coroutine<(), Return = (), Yield = ()>;
|
type Coro = impl Coroutine<(), Return = (), Yield = ()>;
|
||||||
fn start(ctx: Context<Self>) -> Self::Gen {
|
fn start(ctx: Context<Self>) -> Self::Coro {
|
||||||
move || {
|
move || {
|
||||||
match ctx {
|
match ctx {
|
||||||
_ => (),
|
_ => (),
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
mod gen {
|
mod gen {
|
||||||
use std::ops::Coroutine;
|
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 || {
|
move || {
|
||||||
yield yielding;
|
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() {}
|
fn main() {}
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
use std::ops::Coroutine;
|
use std::ops::Coroutine;
|
||||||
|
|
||||||
trait Runnable {
|
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 {}
|
struct Implementor {}
|
||||||
|
|
||||||
impl Runnable for 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
|
//~^ ERROR: type mismatch resolving
|
||||||
move || {
|
move || {
|
||||||
yield 1;
|
yield 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user