Demo use of JSON deserialization
It Just Works. Praise the Rust macros.
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
use gt_tools::ReleaseInfo;
|
||||||
|
|
||||||
use reqwest::Error;
|
use reqwest::Error;
|
||||||
use reqwest::header::{
|
use reqwest::header::{
|
||||||
@@ -19,7 +20,7 @@ async fn main() -> Result<(), Error> {
|
|||||||
.header(ACCEPT, "application/json")
|
.header(ACCEPT, "application/json")
|
||||||
.send()
|
.send()
|
||||||
.await?;
|
.await?;
|
||||||
let body_text: String = response.text().await?;
|
let body_text: Vec<ReleaseInfo> = response.json().await?;
|
||||||
|
|
||||||
println!("{:?}", body_text);
|
println!("{:?}", body_text);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user