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

Fehler integration #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fehler integration #9

wants to merge 1 commit into from

Conversation

withoutboats
Copy link
Owner

@withoutboats withoutboats commented Aug 17, 2020

Takes advantage of fehler's propane integration to make propane
generators Ok-wrapping.

Syntax:

use std::future::Future;
use std::io;

#[propane::generator(throws io::Error)]
async fn foo<T: Future<Output = io::Result<i32>>>(futures: Vec<T>) -> i32 {
    let mut n = 0;
    for x in futures {
       yield x.await?;

       yield n;
       n += 1;
    }
}

Takes advantage of fehler's propane integration to make propane
generators Ok-wrapping.

Syntax:

```rust
fn foo<T: Future<Output = io::Result<i32>>>(futures: Vec<T>) -> i32 {
    let mut n = 0;
    for x in futures {
       yield x.await?;

       yield n;
       n += 1;
    }
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant