Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 233e74e

Browse filesBrowse files
authored
Add Error to Result added note for tokio (#674)
Added error to Result for main, otherwise it won't compile. If tokio isn't added with features = ["full"] main won't work, so I thought it would be a good idea to remind them.
1 parent fa7a71d commit 233e74e
Copy full SHA for 233e74e

File tree

1 file changed

+3
-1
lines changed
Filter options
  • src/web/clients/requests

1 file changed

+3
-1
lines changed

‎src/web/clients/requests/get.md

Copy file name to clipboardExpand all lines: src/web/clients/requests/get.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ fn main() -> Result<()> {
3737

3838
A similar approach can be used by including the [`tokio`] executor
3939
to make the main function asynchronous, retrieving the same information.
40+
Make sure to add tokio = {version = "1.21.2", features = ["full"]} to
41+
your cargo.toml file.
4042

4143
In this example, [`tokio::main`] handles all the heavy executor setup
4244
and allows sequential code implemented without blocking until `.await`.
@@ -55,7 +57,7 @@ error_chain! {
5557
}
5658
5759
#[tokio::main]
58-
async fn main() -> Result<()> {
60+
async fn main() -> Result<(), Box<dyn std::error::Error>> {
5961
let res = reqwest::get("http://httpbin.org/get").await?;
6062
println!("Status: {}", res.status());
6163
println!("Headers:\n{:#?}", res.headers());

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.