remove more unused stuff
This commit is contained in:
parent
c35b5c2aa9
commit
c1266d7653
@ -8,5 +8,4 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
reqwest = { version = "0.10.4", features = ["json", "blocking"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
12
src/main.rs
12
src/main.rs
@ -1,4 +1,3 @@
|
||||
use serde::Deserialize;
|
||||
use serde_json::Value;
|
||||
use std::env;
|
||||
|
||||
@ -9,13 +8,6 @@ const STATUS_URL: &str =
|
||||
const INCIDENTS_URL: &str =
|
||||
"https://status.robertsspaceindustries.com/static/content/api/v0/incidents/timeline.en.json";
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct Status {
|
||||
name: String,
|
||||
status: String,
|
||||
order: u8,
|
||||
}
|
||||
|
||||
fn get_incidents() -> Result<(), reqwest::Error> {
|
||||
let res = reqwest::blocking::get(INCIDENTS_URL)?;
|
||||
let data: Value = res.json()?;
|
||||
@ -46,10 +38,10 @@ fn get_incidents() -> Result<(), reqwest::Error> {
|
||||
|
||||
fn get_status() -> Result<(), reqwest::Error> {
|
||||
let res = reqwest::blocking::get(STATUS_URL)?;
|
||||
let data = res.json::<Vec<Status>>()?;
|
||||
let data: Value = res.json()?;
|
||||
let pu = &data[1];
|
||||
let ea = &data[2];
|
||||
println!("Persistent Universe: {}\nEA: {}", pu.status, ea.status);
|
||||
println!("Persistent Universe: {}\nEA: {}", pu["status"], ea["status"]);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user