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
Clarify use of #[tokio::main]
#743
Comments
Yes, I'm running into a similar issue trying to follow the github examples. Essentially I'm getting
But I can't find any documentation about how to properly use this anywhere. I was able to eventually get it to work by adding I feel that this should be listed in the Requirements section on the README.md file if it's going to be included in all the examples. |
@anthonyjchriste note that when using the non-alpha version of tokio, you'll have to use the feature "macros", see original comment. The need to specify features is because of an architectural change to the whole tokio crate, I can explain more or provide a look if needed, but I'm on phone at the moment. |
I've opened #745 to add a note to the examples. |
@hwchen Thank you! That is very useful information. I'm fairly new to async/await and am finding the ecosystem a bit daunting. I'm writing a web scraper as a pet project and figured that would be a great chance to get into the async/await ecosystem. What you explained makes perfect sense and I was able to find more information in Tokio's blog post: https://tokio.rs/blog/2019-11-tokio-0-2/ |
This is also an issue in hyperium/hyper#2028.
Basically, the #[tokio::main] macro is used for examples but the dependency is not explicitly mentioned in readme or docs. Could be pretty confusing. I haven't seen an issue with reqwest yet, so this is preemptive, but I've seen people have issues with hyper and warp.
Also, the dep should look something like:
tokio = { version = "0.2.3", features = ["macros"] }
The text was updated successfully, but these errors were encountered: