Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Consider add support of recently merged immovable generators #58

Closed
andreytkachenko opened this issue Feb 1, 2018 · 3 comments
Closed

Comments

@andreytkachenko
Copy link
Contributor

Recently immovable generator PR #45337 has been finally merged into the rust's master branch and it is now possible use it in the latest nightly builds.

@alexcrichton
Copy link
Owner

I'd be totally down for a PR along these lines!

@andreytkachenko
Copy link
Contributor Author

I am also don't like unsafe approach, but it makes possible share generators state.
here is an example:

#[async]
fn task(pin: &gpio::Pin) -> Result<(), uart::UartError> {
    let mut buff = [0u8; 16];
    loop {
        await!(uart::read_until(&mut buff, '\n'))?; // without static generators 
                                                    // this will cause a compilation error
        match buff {
            b"on" => pin.set_high(),
            b"off" => pin.set_low(),
            _ => {}
        }
    }
} 

@withoutboats
Copy link
Collaborator

These are now supported :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants