Warp: Clarify use of `#[tokio::main]`

Created on 17 Dec 2019  路  3Comments  路  Source: seanmonstar/warp

This is also an issue in https://github.com/hyperium/hyper/issues/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 have at least one person who copied over the hello world example and it didn't work.

Also, the dep should look something like:

tokio = { version = "0.2.3", features = ["macros"] }

Most helpful comment

+1 - I'd also recommend providing an alternative example that shows how you can create a new tokio runtime without #[tokio::main]

All 3 comments

+1 - I'd also recommend providing an alternative example that shows how you can create a new tokio runtime without #[tokio::main]

I am not yet familiar with the async/await syntax but is the Tokio runtime required to run an async main function ?

I've updated the README to include instructions about adding Tokio as a dependency.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seanmonstar picture seanmonstar  路  8Comments

richardanaya picture richardanaya  路  6Comments

weiznich picture weiznich  路  7Comments

Newbytee picture Newbytee  路  7Comments

kitsuneninetails picture kitsuneninetails  路  4Comments