ddragon
Rust library for accessing the latest League of Legends patch's ddragon data.
- Fully (de)serializable, well-typed structs
- Supports TFT data
- Provides a synchronous API by default
- Local caching via
cacache - Accepts custom
ureqagents (which can use the exposed cache middleware)
- Local caching via
- Optionally, an asynchronous API can be used that maintains the same featureset
- Local caching is handled by
http-cache-reqwestrather than a custom middleware - Also accepts custom
reqwestorreqwest-middlewareclients
- Local caching is handled by
- Optionally, some useful functions to fetch and decode images, via
image - Optionally, minimal support of cdragon data
Usage
use ;
Features
The following crate features are available:
-
sync(on by default) enables the synchronous client.- Provides the
ddragon::clientandddragon::cache_middlewaremodule. - Provides the re-exported
ddragon::Clientandddragon::ClientBuilderimpls. - Adds
cacache,url,thiserror, andureqwith thejsonfeature enabled as dependencies.
- Provides the
-
asyncenables the asynchronous client.- Provides the
ddragon::async_clientmodule. - Provides the re-exported
ddragon::AsyncClientandddragon::AsyncClientBuilderimpls. - Adds
reqwestwith thejsonfeature,reqwest-middlewareandhttp-cache-reqwestas dependencies. - If you would like the client to use
rustls, use theasync-rustlsfeature instead.
- Provides the
-
imageenables image fetching and caching.- Both clients will receive
image_ofandsprite_offor any model which implementsHasImage. - Adds the
imagedependency.
- Both clients will receive
-
cdragonenables support for sourcing data from CommunityDragon.- At the moment, this just adds a method for fetching Arena mode augments.
-
To use the library with just the synchronous version, it should be as simple as adding any other dependency:
[]
= "<version>"
- If you would also like to have the image fetching support, use:
[]
= { = "<version>", = ["image"] }
- If you want the asynchronous client only, you probably don't want to pull in the dependencies related to the synchronous code, so you can do this:
[]
= { = "<version>", = false, = ["async"] }
- If you want the async client and you want to use
rustls(and you wantddragonto generate the client), you can use:
[]
= { = "<version>", = false, = ["async-rustls"] }
Note that if you are providing your own client (via AsyncClientBuilder::new().agent()) you can use either async feature set.
- If you only want the DDragon models (none of the client code), you can use
[]
= { = "<version>", = false }
MSRV
Currently, this crate support Rust >= 1.71.1.