Unofficial Rust crate for the osu! API.
Add the following dependency to your Cargo.toml:
toml
osu = "0.2"
And include it in your project:
rust
extern crate osu;
Using hyper
with the hyper-tls
HTTPS connector, retrieve the start time of a
match by ID:
```rust extern crate futures; extern crate hyper; extern crate hypertls; extern crate osu; extern crate tokiocore;
use futures::Future; use hyper::client::{Client, HttpConnector}; use hypertls::HttpsConnector; use osu::bridge::hyper::OsuHyperRequester; use std::error::Error; use std::env; use tokiocore::reactor::Core;
fn trymain() -> Result<(), Box
let done = client.get_match(&key, 71641).map(|match| {
println!("Match start time: {}", match.start_time);
()
}).map_err(|_| ());
core.run(done).expect("Error running core");
Ok(())
}
fn main() { try_main().unwrap(); } ```
Using reqwest, retrieve a match's start time by ID:
```rust extern crate osu; extern crate reqwest;
use osu::bridge::reqwest::OsuReqwestRequester; use reqwest::Client; use std::error::Error;
fn trymain() -> Result<(), Box
println!("Match start time: {}", match.start_time);
Ok(())
}
fn main() { try_main().unwrap(); } ```
License info in [LICENSE.md]. Long story short, ISC.