[][src]Crate beatsaver_rs

beatsaver-rs

This probject is a Rust library for interacting with the BeatSaver api.

The library is a work in progress and the API has not been stablized, so expect breaking changes.

See also:

Using the API

use beatsaver_rs::BeatSaverApi;
use beatsaver_rs::client::BeatSaver;
use beatsaver_rs::map::Map;
use bytes::Bytes;
use std::convert::TryInto;

#[tokio::main]
async fn main() {
    let client = BeatSaver::new();
    let map: Map = client.map(&"1".try_into().unwrap()).await.unwrap();
    println!("Map by key: {}", map.name);
    let map: Map = client.map(&"fda568fc27c20d21f8dc6f3709b49b5cc96723be".try_into().unwrap()).await.unwrap();
    println!("Map by hash: {}", map.name);
    let map_download: Bytes = client.download((&map).into()).await.unwrap();
    // save map somewhere
}

Modules

client

Client

map

Map

Structs

BEATSAVER_URL

Base URL for the beatsaver API

BeatSaverRateLimit

Structure used for deserializing rate limit errors

BeatSaverUser

Holds data for a beatsaver user

Page

Page metadata for APIs that paginate results

Enums

BeatSaverApiError

Error that could occur when querying the API

MapId

Specifier used to index a map

MapIdError

Error type for parsing a Map ID

Traits

BeatSaverApi

API trait for asynchronous clients

BeatSaverApiAsync

API trait for asynchronous clients

Functions

rate_limit

Converts the body of a 429 response to a BeatSaverApiError::RateLimitError