Struct dagpirs::data::Data [−][src]
pub struct Data { /* fields omitted */ }
Expand description
Data fetching functions for async client.
Implementations
get a hot fiery roast Basic Data endpoint might return a custom struct
Example
use dagpirs::{Client, models::Roast}; use tokio; #[tokio::main] async fn main() { let token = std::env::var("DAGPI_TOKEN").unwrap(); let c = Client::new(&token).unwrap(); if let Ok(i) = c.data.roast().await { match i { Ok(r) => { println!("{}", r.roast); }, Err(e) => panic!("{}", e) } } }
get a random joke
get a random flag!
get a random WTP object A more complex Struct with lots of field is like the WTP
Example
use dagpirs::{Client, models::WTP}; use tokio; #[tokio::main] async fn main() { let token = std::env::var("DAGPI_TOKEN").unwrap(); let c = Client::new(&token).unwrap(); if let Ok(i) = c.data.wtp().await { match i { Ok(r) => { println!("question: {}\nanswer: {}\nname: {}\nid: {}", r.question, r.answer, r.Data.name, r.Data.id); }, Err(e) => panic!("{}", e) } } }
get a random headline. Can be fake or real
Get a random logo
Get an Easy Logo
Pickup Line
Random Fact
Yomama Joke
Auto Trait Implementations
impl !RefUnwindSafe for Data
impl !UnwindSafe for Data