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

issue-618 2024 edition and removes lints #707

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/web/clients/api/rest-get.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,22 @@ with [`reqwest::get`] to get list of all users who have marked a GitHub project
[tokio::main] is used to set up the async executor and the process waits for [`reqwest::get`] to complete before
processing the response into User instances.

```rust,edition2018,no_run
to set up the crates required to run this example run

```
cargo new
cargo add reqwest serde tokio
```

edit the Cargo.toml to add features

```
reqwest = { version = "..", features = ["json"] }
serde = { version = "", features = ["derive"] }
tokio = { version = "..", features = ["full"] }
```

```rust,edition2024
use serde::Deserialize;
use reqwest::Error;
use reqwest::header::USER_AGENT;
Expand All @@ -35,7 +50,8 @@ async fn main() -> Result<(), Error> {
.await?;

let users: Vec<User> = response.json().await?;
println!("{:?}", users);
users.iter().for_each(|user| println!("{:?} {}({})", user, user.login, user.id));

Ok(())
}
```
Expand Down