#![cfg_attr(docsrs, feature(doc_cfg), deny(broken_intra_doc_links))]
#![deny(
clippy::all,
nonstandard_style,
rust_2018_idioms,
unused,
warnings,
missing_debug_implementations,
missing_docs
)]
pub mod catch;
pub mod mania;
pub mod osu;
pub mod taiko;
pub mod parse;
pub mod beatmap;
pub use beatmap::{Beatmap, BeatmapExt, GameMode};
mod gradual;
pub use gradual::{GradualDifficultyAttributes, GradualPerformanceAttributes, ScoreState};
mod pp;
pub use pp::{AnyPP, AttributeProvider, HitResultPriority};
mod stars;
pub use stars::AnyStars;
mod curve;
mod mods;
mod util;
pub use catch::{CatchPP, CatchStars};
pub use mania::{ManiaPP, ManiaStars};
pub use osu::{OsuPP, OsuStars};
pub use taiko::{TaikoPP, TaikoStars};
pub use mods::Mods;
pub use parse::{ParseError, ParseResult};
pub use util::SortedVec;
#[derive(Clone, Debug)]
pub enum Strains {
Osu(osu::OsuStrains),
Taiko(taiko::TaikoStrains),
Catch(catch::CatchStrains),
Mania(mania::ManiaStrains),
}
impl Strains {
#[inline]
pub fn section_len(&self) -> f64 {
match self {
Strains::Osu(strains) => strains.section_len,
Strains::Taiko(strains) => strains.section_len,
Strains::Catch(strains) => strains.section_len,
Strains::Mania(strains) => strains.section_len,
}
}
#[inline]
#[allow(clippy::len_without_is_empty)]
pub fn len(&self) -> usize {
match self {
Strains::Osu(strains) => strains.len(),
Strains::Taiko(strains) => strains.len(),
Strains::Catch(strains) => strains.len(),
Strains::Mania(strains) => strains.len(),
}
}
}
#[derive(Clone, Debug)]
pub enum DifficultyAttributes {
Osu(osu::OsuDifficultyAttributes),
Taiko(taiko::TaikoDifficultyAttributes),
Catch(catch::CatchDifficultyAttributes),
Mania(mania::ManiaDifficultyAttributes),
}
impl DifficultyAttributes {
#[inline]
pub fn stars(&self) -> f64 {
match self {
Self::Osu(attrs) => attrs.stars,
Self::Taiko(attrs) => attrs.stars,
Self::Catch(attrs) => attrs.stars,
Self::Mania(attrs) => attrs.stars,
}
}
#[inline]
pub fn max_combo(&self) -> usize {
match self {
Self::Osu(attrs) => attrs.max_combo,
Self::Taiko(attrs) => attrs.max_combo,
Self::Catch(attrs) => attrs.max_combo(),
Self::Mania(attrs) => attrs.max_combo,
}
}
}
impl From<osu::OsuDifficultyAttributes> for DifficultyAttributes {
#[inline]
fn from(attributes: osu::OsuDifficultyAttributes) -> Self {
Self::Osu(attributes)
}
}
impl From<taiko::TaikoDifficultyAttributes> for DifficultyAttributes {
#[inline]
fn from(attributes: taiko::TaikoDifficultyAttributes) -> Self {
Self::Taiko(attributes)
}
}
impl From<catch::CatchDifficultyAttributes> for DifficultyAttributes {
#[inline]
fn from(attributes: catch::CatchDifficultyAttributes) -> Self {
Self::Catch(attributes)
}
}
impl From<mania::ManiaDifficultyAttributes> for DifficultyAttributes {
#[inline]
fn from(attributes: mania::ManiaDifficultyAttributes) -> Self {
Self::Mania(attributes)
}
}
#[derive(Clone, Debug)]
pub enum PerformanceAttributes {
Osu(osu::OsuPerformanceAttributes),
Taiko(taiko::TaikoPerformanceAttributes),
Catch(catch::CatchPerformanceAttributes),
Mania(mania::ManiaPerformanceAttributes),
}
impl PerformanceAttributes {
#[inline]
pub fn pp(&self) -> f64 {
match self {
Self::Osu(attrs) => attrs.pp,
Self::Taiko(attrs) => attrs.pp,
Self::Catch(attrs) => attrs.pp,
Self::Mania(attrs) => attrs.pp,
}
}
#[inline]
pub fn stars(&self) -> f64 {
match self {
Self::Osu(attrs) => attrs.stars(),
Self::Taiko(attrs) => attrs.stars(),
Self::Catch(attrs) => attrs.stars(),
Self::Mania(attrs) => attrs.stars(),
}
}
#[inline]
pub fn difficulty_attributes(&self) -> DifficultyAttributes {
match self {
Self::Osu(attrs) => DifficultyAttributes::Osu(attrs.difficulty.clone()),
Self::Taiko(attrs) => DifficultyAttributes::Taiko(attrs.difficulty.clone()),
Self::Catch(attrs) => DifficultyAttributes::Catch(attrs.difficulty.clone()),
Self::Mania(attrs) => DifficultyAttributes::Mania(attrs.difficulty),
}
}
#[inline]
pub fn max_combo(&self) -> usize {
match self {
Self::Osu(attrs) => attrs.difficulty.max_combo,
Self::Taiko(attrs) => attrs.difficulty.max_combo,
Self::Catch(attrs) => attrs.difficulty.max_combo(),
Self::Mania(attrs) => attrs.difficulty.max_combo,
}
}
}
impl From<PerformanceAttributes> for DifficultyAttributes {
#[inline]
fn from(attributes: PerformanceAttributes) -> Self {
match attributes {
PerformanceAttributes::Osu(attrs) => Self::Osu(attrs.difficulty),
PerformanceAttributes::Taiko(attrs) => Self::Taiko(attrs.difficulty),
PerformanceAttributes::Catch(attrs) => Self::Catch(attrs.difficulty),
PerformanceAttributes::Mania(attrs) => Self::Mania(attrs.difficulty),
}
}
}
impl From<osu::OsuPerformanceAttributes> for PerformanceAttributes {
#[inline]
fn from(attributes: osu::OsuPerformanceAttributes) -> Self {
Self::Osu(attributes)
}
}
impl From<taiko::TaikoPerformanceAttributes> for PerformanceAttributes {
#[inline]
fn from(attributes: taiko::TaikoPerformanceAttributes) -> Self {
Self::Taiko(attributes)
}
}
impl From<catch::CatchPerformanceAttributes> for PerformanceAttributes {
#[inline]
fn from(attributes: catch::CatchPerformanceAttributes) -> Self {
Self::Catch(attributes)
}
}
impl From<mania::ManiaPerformanceAttributes> for PerformanceAttributes {
#[inline]
fn from(attributes: mania::ManiaPerformanceAttributes) -> Self {
Self::Mania(attributes)
}
}
#[cfg(all(feature = "async_tokio", feature = "async_std"))]
compile_error!("Only one of the features `async_tokio` and `async_std` should be enabled");