Delete random_quote directory
This commit is contained in:
parent
31173018f3
commit
764cbfdf48
1114
random_quote/Cargo.lock
generated
1114
random_quote/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,13 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "random_quote"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
json = "0.12.4"
|
|
||||||
serde_json = "1.0.94"
|
|
||||||
reqwest = { version = "0.11", features = ["json", "blocking"] }
|
|
||||||
tokio = { version = "1", features = ["full"] }
|
|
||||||
serde = { version = "1.0.130", features = ["derive"] }
|
|
@ -1,21 +0,0 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use reqwest::blocking::get;
|
|
||||||
|
|
||||||
pub type Response = Vec<Quote>;
|
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Quote {
|
|
||||||
pub q: String,
|
|
||||||
pub a: String,
|
|
||||||
pub h: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let res = get("https://zenquotes.io/api/random").unwrap();
|
|
||||||
let quotes = res.json::<Response>().unwrap();
|
|
||||||
for quote in quotes {
|
|
||||||
println!("Author: {}", quote.a);
|
|
||||||
println!("Quote: {}", quote.q);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user