Crates.io | ddragon |
lib.rs | ddragon |
version | |
source | src |
created_at | 2023-01-19 23:52:36.960811 |
updated_at | 2024-12-08 16:31:09.997577 |
description | Library for pulling data from ddragon, with caching support. |
homepage | https://github.com/kade-robertson/ddragon |
repository | https://github.com/kade-robertson/ddragon |
max_upload_size | |
id | 763022 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Rust library for accessing the latest League of Legends patch's ddragon data.
cacache
ureq
agents (which can use the exposed cache middleware)http-cache-reqwest
rather than a custom middlewarereqwest
or reqwest-middleware
clientsimage
use ddragon::{cache_middleware::CacheMiddleware, Client, ClientBuilder, ClientError};
fn main() -> Result<(), ClientError> {
let client = Client::new("/path/to/your/cache/dir")?;
// If you want to use an existing agent
let my_agent = ureq::AgentBuilder::new()
.middleware(CacheMiddleware::new("/path/to/your/cache/dir"))
.build();
let client = ClientBuilder::new().agent(my_agent).build()?;
// See available options on the client and in the models folder.
let champions = client.champions()?;
let runes = client.runes()?;
let tft_items = client.tft_items()?;
Ok(())
}
The following crate features are available:
sync
(on by default) enables the synchronous client.
ddragon::client
and ddragon::cache_middleware
module.ddragon::Client
and ddragon::ClientBuilder
impls.cacache
, url
, thiserror
, and ureq
with the json
feature enabled as dependencies.async
enables the asynchronous client.
ddragon::async_client
module.ddragon::AsyncClient
and ddragon::AsyncClientBuilder
impls.reqwest
with the json
feature, reqwest-middleware
and http-cache-reqwest
as dependencies.rustls
, use the async-rustls
feature instead.image
enables image fetching and caching.
image_of
and sprite_of
for any model which implements HasImage
.image
dependency.To use the library with just the synchronous version, it should be as simple as adding any other dependency:
[dependencies]
ddragon = "<version>"
[dependencies]
ddragon = { version = "<version>", features = ["image"] }
[dependencies]
ddragon = { version = "<version>", default-features = false, features = ["async"] }
rustls
(and you want ddragon
to generate the client), you can use:[dependencies]
ddragon = { version = "<version>", default-features = false, features = ["async-rustls"] }
Note that if you are providing your own client (via AsyncClientBuilder::new().agent()
) you can use either async
feature set.
[dependencies]
ddragon = { version = "<version>", default-features = false }
Currently, this crate support Rust >= 1.67.1.