Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explicitly mark coroutine closures. #16

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions effing-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ pub fn effectful(args: TokenStream, item: TokenStream) -> TokenStream {
Yield = #yield_type,
Return = #return_type
> #clone_bound {
#[coroutine]
move |_begin: <#yield_type as ::effing_mad::injection::EffectList>::Injections| {
#block
}
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ pub fn map<E, I, T, U>(
g: impl Coroutine<I, Yield = E, Return = T>,
f: impl FnOnce(T) -> U,
) -> impl Coroutine<I, Yield = E, Return = U> {
#[coroutine]
static move |mut injs: I| {
let mut pinned = pin!(g);
loop {
Expand Down Expand Up @@ -207,6 +208,7 @@ where
PostIs: CoproductEmbedder<PreIs, EmbedIndices>,
G: Coroutine<PreIs, Yield = PreEs, Return = R>,
{
#[coroutine]
static move |_begin: PostIs| {
let mut injection = PreIs::inject(Begin);
let mut pinned = pin!(g);
Expand Down Expand Up @@ -342,6 +344,7 @@ where
> + CoproductSubsetter<HandlerIs, SubsetIndices2>,
G1: Coroutine<PreIs, Yield = PreEs, Return = R>,
{
#[coroutine]
static move |_begin: PostIs| {
let mut injection = PreIs::inject(Begin);
let mut pinned = pin!(g);
Expand Down