rmanoka / async-scoped

A scope for async_std and tokio to spawn non-static futures
117 stars 14 forks source link

Minor doc tweaks so they compile straight away #1

Closed michael-grunder closed 4 years ago

michael-grunder commented 4 years ago

Just small changes to README.md so the examples compile outside of the crate.

rmanoka commented 4 years ago

@michael-grunder Thanks for the contributions!

Are you sure #![feature(async_closure)] is necessary to compile? I don't use it elsewhere in the code, and the tests seem to succeed without it. This feature is still unstable, and we should avoid unless necessary.

michael-grunder commented 4 years ago

Thanks for the reply!

I pulled the code out into a separate project and switched them to normal async functions (as opposed to tests).

Looks like scoped_futures does need the directive, while test_scope_and_block does not.

I'm not sure on why though, since it sure looks like they're both using async closures, but I'm still pretty new to Rust (and especially async rust).

You can find the repo here.

Edit: If it's useful, I'm running 1.40.0 stable, and 1.42.0-nightly

rmanoka commented 4 years ago

Oh right! We should swap the order: use || async instead of async ||. The former is just a regular closure that returns a future and the latter is an async_closure. Could you make that change and remove the feature attributes?

Thanks!

rmanoka commented 4 years ago

Looks good to me. Thanks!