Crates.io | norris-jokes |
lib.rs | norris-jokes |
version | 0.2.0 |
source | src |
created_at | 2024-06-18 22:25:41.111207 |
updated_at | 2024-06-19 21:14:19.381467 |
description | Chuck Norris jokes API sync & async fetcher library for Rust applications |
homepage | https://github.com/skewnart/norris-jokes-api |
repository | https://github.com/skewnart/norris-jokes-api |
max_upload_size | |
id | 1276260 |
size | 12,901 |
Chuck Norris jokes API sync & async fetcher library for Rust applications
use norris_jokes::jokecategory::JokeCategory;
fn main() {
let mut result = norris_jokes::get_random();
println!("{:?}", result);
result = norris_jokes::get_random_with_category(JokeCategory::Sport);
println!("{:?}", result);
let result_list = norris_jokes::get_with_query("sport");
println!("{:?}", result_list);
}
use norris_jokes::jokecategory::JokeCategory;
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let mut joke = norris_jokes::get_random_async().await;
println!("{:?}", joke);
joke = norris_jokes::get_random_with_category_async(JokeCategory::Sport).await;
println!("{:?}", joke);
let result_list = norris_jokes::get_with_query_async("sport").await;
println!("{:?}", result_list);
Ok(())
}