Struct dagpirs::data::Data [−][src]
Data fetching functions for async client.
Implementations
impl Data
[src]
pub async fn roast(&self) -> HttpResult<Roast, String>
[src]
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) } } }
pub async fn joke(&self) -> HttpResult<Joke, String>
[src]
get a random joke
pub async fn flag(&self) -> HttpResult<Flag, String>
[src]
get a random flag!
pub async fn wtp(&self) -> HttpResult<WTP, String>
[src]
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) } } }
pub async fn headline(&self) -> HttpResult<Headline, String>
[src]
get a random headline. Can be fake or real
pub async fn logo(&self) -> HttpResult<Logo, String>
[src]
Get a random logo
pub async fn easy_logo(&self) -> HttpResult<Logo, String>
[src]
Get an Easy Logo
pub async fn pickup_line(&self) -> HttpResult<PickupLine, String>
[src]
Pickup Line
pub async fn fact(&self) -> HttpResult<Fact, String>
[src]
Random Fact
pub async fn yomama(&self) -> HttpResult<YomamaJoke, String>
[src]
Yomama Joke
Auto Trait Implementations
impl !RefUnwindSafe for Data
impl Send for Data
impl Sync for Data
impl Unpin for Data
impl !UnwindSafe for Data
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,