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

Add BlockAwait trait #2803

Closed
wants to merge 1 commit into from
Closed

Add BlockAwait trait #2803

wants to merge 1 commit into from

Conversation

hwittenborn
Copy link

This change adds in a trait called BlockAwait, which functions like futures::executor::block_on, but allows for a chaining style similar to .await syntax.

I wasn't positive if this would be wanted, but considering how simple it was I decided I'd just go ahead and make it.

I also wasn't completely sure on how I should limit the trait to only be implemented on Future types (and possibly how to prevent it's implementation from being overridden), but I'm open to feedback in the area if my implementation isn't the best.

@taiki-e
Copy link
Member

taiki-e commented Nov 25, 2023

Users are free to define such helpers themselves, but I would prefer that this not be provided as part of the futures crate.
See smol-rs/async-task#16 (comment) and subsequent comments for more.

Thanks anyway for the PR!

@taiki-e taiki-e closed this Nov 25, 2023
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.

2 participants