Bindings to the splits.io API for Rust. Both native platforms and the web are supported.
// Create a splits.io API client.
let client = Client::new();
// Search for a runner.
let runner = Runner::search(&client, "cryze")
.await?
.into_iter()
.next()
.context("There is no runner with that name")?;
assert_eq!(&*runner.name, "cryze92");
// Get the PBs for the runner.
let first_pb = runner.pbs(&client)
.await?
.into_iter()
.next()
.context("This runner doesn't have any PBs")?;
// Get the game for the PB.
let game = first_pb.game.context("There is no game for the PB")?;
assert_eq!(&*game.name, "The Legend of Zelda: The Wind Waker");
// Get the categories for the game.
let categories = game.categories(&client).await?;
// Get the runs for the Any% category.
let runs = categories
.iter()
.find(|category| &*category.name == "Any%")
.context("Couldn't find category")?
.runs(&client)
.await?;
assert!(!runs.is_empty());
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.