remove more unused stuff

master
CptCaptain 5 years ago
parent c35b5c2aa9
commit c1266d7653
  1. 1
      Cargo.toml
  2. 12
      src/main.rs

@ -8,5 +8,4 @@ edition = "2018"
[dependencies] [dependencies]
reqwest = { version = "0.10.4", features = ["json", "blocking"] } reqwest = { version = "0.10.4", features = ["json", "blocking"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"

@ -1,4 +1,3 @@
use serde::Deserialize;
use serde_json::Value; use serde_json::Value;
use std::env; use std::env;
@ -9,13 +8,6 @@ const STATUS_URL: &str =
const INCIDENTS_URL: &str = const INCIDENTS_URL: &str =
"https://status.robertsspaceindustries.com/static/content/api/v0/incidents/timeline.en.json"; "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> { fn get_incidents() -> Result<(), reqwest::Error> {
let res = reqwest::blocking::get(INCIDENTS_URL)?; let res = reqwest::blocking::get(INCIDENTS_URL)?;
let data: Value = res.json()?; let data: Value = res.json()?;
@ -46,10 +38,10 @@ fn get_incidents() -> Result<(), reqwest::Error> {
fn get_status() -> Result<(), reqwest::Error> { fn get_status() -> Result<(), reqwest::Error> {
let res = reqwest::blocking::get(STATUS_URL)?; let res = reqwest::blocking::get(STATUS_URL)?;
let data = res.json::<Vec<Status>>()?; let data: Value = res.json()?;
let pu = &data[1]; let pu = &data[1];
let ea = &data[2]; let ea = &data[2];
println!("Persistent Universe: {}\nEA: {}", pu.status, ea.status); println!("Persistent Universe: {}\nEA: {}", pu["status"], ea["status"]);
Ok(()) Ok(())
} }

Loading…
Cancel
Save