USING RUST
This is an unofficial example. We do not provide any support on the Discord Server.

INSTALLATION

1
[dependencies]
2
nekosbest = "0.8"
Copied!

USAGE

GET a Neko
GET multiple Nekos
1
#[tokio::main]
2
async fn main() -> Result<(), Box<dyn std::error::Error>> {
3
let img_url: String = nekosbest::get(nekosbest::Category::Nekos).await?.url;
4
println!("{}", img_url);
5
Ok(())
6
}
Copied!
1
#[tokio::main]
2
async fn main() -> Result<(), Box<dyn std::error::Error>> {
3
let images = nekosbest::get_amount(nekosbest::Category::Nekos, 20).await?.url;
4
println!("{:?}", images);
5
Ok(())
6
}
Copied!
Or if you already have a reqwest::Client that you want to use, use get_with_client and get_with_client_amount respectively.
There is another property called details:

For Category::Nekos:

1
#[tokio::main]
2
async fn main() -> Result<(), Box<dyn std::error::Error>> {
3
let details = nekosbest::get(nekosbest::Category::Nekos).await?.details.try_into_nekos().unwrap();
4
println!("Source: {}", details.source_url);
5
println!("Artist: {}", details.artist_name);
6
println!("Artist link: {}", details.artist_href);
7
Ok(())
8
}
Copied!

For everything else (GIF Endpoints):

1
#[tokio::main]
2
async fn main() -> Result<(), Box<dyn std::error::Error>> {
3
let details = nekosbest::get(nekosbest::Category::Pat).await?.details.try_into_gif().unwrap();
4
println!("Anime name: {}", details.anime_name);
5
Ok(())
6
}
Copied!

For more usages visit the Crates.io or GitHub page.

CREDITS

Thanks to dblanovschi for your Rust API wrapper.
Last modified 9d ago
Copy link