| Crates.io | booru |
| lib.rs | booru |
| version | 0.6.0 |
| created_at | 2023-09-29 16:49:13.466969+00 |
| updated_at | 2024-08-31 02:55:01.596728+00 |
| description | An async Booru client for Rust |
| homepage | |
| repository | https://github.com/cijiugechu/booru |
| max_upload_size | |
| id | 987601 |
| size | 97,348 |
booruAn async Booru client for Rust.
Note: This project has been forked from booru-rs since September of 2023, but a lot has changed.
The client currently supports:
Remember to bring the Client trait into scope with use booru::client::Client;.
use booru::{
client::{gelbooru::GelbooruClient, generic::*, Client},
model::gelbooru::GelbooruRating,
};
#[tokio::main]
async fn main() {
let posts = GelbooruClient::builder()
.tag("kafuu_chino")
.tag("2girls")
.rating(GelbooruRating::General)
.sort(Sort::Score)
.limit(5)
.random()
.blacklist_tag(GelbooruRating::Explicit)
.build()
.get()
.await
.expect("There was an error retrieving posts from the API");
}
If you want to customize http client, you can use builder_with_http_client:
use booru::{
client::{gelbooru::GelbooruClient, generic::*, Client},
model::gelbooru::GelbooruRating,
};
use reqwest;
use std::time::Duration;
#[tokio::main]
async fn main() {
let http_client_builder = reqwest::ClientBuilder::new()
.timeout(Duration::from_secs(10));
let posts = GelbooruClient::builder_with_http_client(http_client_builder)
.tag("kafuu_chino")
.limit(5)
.build()
.get()
.await
.expect("There was an error retrieving posts from the API");
}