refactor!: renamed gradual calc types
This commit is contained in:
+1
-1
@@ -23,4 +23,4 @@ impl From<u8> for GameMode {
|
||||
_ => Self::Osu,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ use super::{
|
||||
/// Note that it does not return attributes after a tiny droplet. Only for fruits and droplets.
|
||||
///
|
||||
/// If you want to calculate performance attributes, use
|
||||
/// [`CatchGradualPerformanceAttributes`](crate::catch::CatchGradualPerformanceAttributes) instead.
|
||||
/// [`CatchGradualPerformanceAttributes`](crate::catch::CatchGradualPerformance) instead.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use rosu_pp::{Beatmap, catch::CatchGradualDifficultyAttributes};
|
||||
/// use rosu_pp::{Beatmap, catch::CatchGradualDifficulty};
|
||||
///
|
||||
/// # /*
|
||||
/// let map: Beatmap = ...
|
||||
@@ -37,7 +37,7 @@ use super::{
|
||||
/// # let map = Beatmap::default();
|
||||
///
|
||||
/// let mods = 64; // DT
|
||||
/// let mut iter = CatchGradualDifficultyAttributes::new(&map, mods);
|
||||
/// let mut iter = CatchGradualDifficulty::new(&map, mods);
|
||||
///
|
||||
/// let attrs1 = iter.next(); // the difficulty of the map after the first hit object
|
||||
/// let attrs2 = iter.next(); // after the second hit object
|
||||
@@ -48,7 +48,7 @@ use super::{
|
||||
/// }
|
||||
/// ```
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CatchGradualDifficultyAttributes<'map> {
|
||||
pub struct CatchGradualDifficulty<'map> {
|
||||
pub(crate) idx: usize,
|
||||
clock_rate: f64,
|
||||
hit_objects: CatchObjectIter<'map>,
|
||||
@@ -61,7 +61,7 @@ pub struct CatchGradualDifficultyAttributes<'map> {
|
||||
strain_peak_buf: Vec<f64>,
|
||||
}
|
||||
|
||||
impl<'map> CatchGradualDifficultyAttributes<'map> {
|
||||
impl<'map> CatchGradualDifficulty<'map> {
|
||||
/// Create a new difficulty attributes iterator for osu!catch maps.
|
||||
pub fn new(map: &'map Beatmap, mods: u32) -> Self {
|
||||
let map_attributes = map.attributes().mods(mods).build();
|
||||
@@ -105,7 +105,7 @@ impl<'map> CatchGradualDifficultyAttributes<'map> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Iterator for CatchGradualDifficultyAttributes<'_> {
|
||||
impl Iterator for CatchGradualDifficulty<'_> {
|
||||
type Item = CatchDifficultyAttributes;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{Beatmap, CatchPP};
|
||||
|
||||
use super::{CatchGradualDifficultyAttributes, CatchPerformanceAttributes, CatchScoreState};
|
||||
use super::{CatchGradualDifficulty, CatchPerformanceAttributes, CatchScoreState};
|
||||
|
||||
/// Gradually calculate the performance attributes of an osu!catch map.
|
||||
///
|
||||
@@ -17,12 +17,12 @@ use super::{CatchGradualDifficultyAttributes, CatchPerformanceAttributes, CatchS
|
||||
/// to be processed. Only fruits and droplets do.
|
||||
///
|
||||
/// If you only want to calculate difficulty attributes use
|
||||
/// [`CatchGradualDifficultyAttributes`](crate::catch::CatchGradualDifficultyAttributes) instead.
|
||||
/// [`CatchGradualDifficultyAttributes`](crate::catch::CatchGradualDifficulty) instead.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use rosu_pp::{Beatmap, catch::{CatchGradualPerformanceAttributes, CatchScoreState}};
|
||||
/// use rosu_pp::{Beatmap, catch::{CatchGradualPerformance, CatchScoreState}};
|
||||
///
|
||||
/// # /*
|
||||
/// let map: Beatmap = ...
|
||||
@@ -30,7 +30,7 @@ use super::{CatchGradualDifficultyAttributes, CatchPerformanceAttributes, CatchS
|
||||
/// # let map = Beatmap::default();
|
||||
///
|
||||
/// let mods = 64; // DT
|
||||
/// let mut gradual_perf = CatchGradualPerformanceAttributes::new(&map, mods);
|
||||
/// let mut gradual_perf = CatchGradualPerformance::new(&map, mods);
|
||||
/// let mut state = CatchScoreState::new(); // empty state, everything is on 0.
|
||||
///
|
||||
/// // The first 10 hitresults are only fruits
|
||||
@@ -96,15 +96,15 @@ use super::{CatchGradualDifficultyAttributes, CatchPerformanceAttributes, CatchS
|
||||
/// assert!(gradual_perf.next(state).is_none());
|
||||
/// ```
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CatchGradualPerformanceAttributes<'map> {
|
||||
difficulty: CatchGradualDifficultyAttributes<'map>,
|
||||
pub struct CatchGradualPerformance<'map> {
|
||||
difficulty: CatchGradualDifficulty<'map>,
|
||||
performance: CatchPP<'map>,
|
||||
}
|
||||
|
||||
impl<'map> CatchGradualPerformanceAttributes<'map> {
|
||||
impl<'map> CatchGradualPerformance<'map> {
|
||||
/// Create a new gradual performance calculator for osu!standard maps.
|
||||
pub fn new(map: &'map Beatmap, mods: u32) -> Self {
|
||||
let difficulty = CatchGradualDifficultyAttributes::new(map, mods);
|
||||
let difficulty = CatchGradualDifficulty::new(map, mods);
|
||||
let performance = CatchPP::new(map).mods(mods).passed_objects(0);
|
||||
|
||||
Self {
|
||||
|
||||
+2
-3
@@ -17,8 +17,7 @@ pub use self::{catch_object::CatchObject, pp::*, score_state::CatchScoreState};
|
||||
|
||||
#[cfg(feature = "gradual")]
|
||||
pub use self::{
|
||||
gradual_difficulty::CatchGradualDifficultyAttributes,
|
||||
gradual_performance::CatchGradualPerformanceAttributes,
|
||||
gradual_difficulty::CatchGradualDifficulty, gradual_performance::CatchGradualPerformance,
|
||||
};
|
||||
|
||||
pub(crate) use self::fruit_or_juice::{FruitOrJuice, FruitParams};
|
||||
@@ -83,7 +82,7 @@ impl<'map> CatchStars<'map> {
|
||||
///
|
||||
/// If you want to calculate the difficulty after every few objects, instead of
|
||||
/// using [`CatchStars`] multiple times with different `passed_objects`, you should use
|
||||
/// [`CatchGradualDifficultyAttributes`](crate::catch::CatchGradualDifficultyAttributes).
|
||||
/// [`CatchGradualDifficultyAttributes`](crate::catch::CatchGradualDifficulty).
|
||||
#[inline]
|
||||
pub fn passed_objects(mut self, passed_objects: usize) -> Self {
|
||||
self.passed_objects = Some(passed_objects);
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ impl<'map> CatchPP<'map> {
|
||||
///
|
||||
/// If you want to calculate the performance after every few objects, instead of
|
||||
/// using [`CatchPP`] multiple times with different `passed_objects`, you should use
|
||||
/// [`CatchGradualPerformanceAttributes`](crate::catch::CatchGradualPerformanceAttributes).
|
||||
/// [`CatchGradualPerformanceAttributes`](crate::catch::CatchGradualPerformance).
|
||||
#[inline]
|
||||
pub fn passed_objects(mut self, passed_objects: usize) -> Self {
|
||||
self.passed_objects.replace(passed_objects);
|
||||
|
||||
+45
-45
@@ -1,10 +1,10 @@
|
||||
#![cfg(feature = "gradual")]
|
||||
|
||||
use crate::{
|
||||
catch::{CatchGradualDifficultyAttributes, CatchGradualPerformanceAttributes},
|
||||
mania::{ManiaGradualDifficultyAttributes, ManiaGradualPerformanceAttributes},
|
||||
osu::{OsuGradualDifficultyAttributes, OsuGradualPerformanceAttributes},
|
||||
taiko::{TaikoGradualDifficultyAttributes, TaikoGradualPerformanceAttributes},
|
||||
catch::{CatchGradualDifficulty, CatchGradualPerformance},
|
||||
mania::{ManiaGradualDifficulty, ManiaGradualPerformance},
|
||||
osu::{OsuGradualDifficulty, OsuGradualPerformance},
|
||||
taiko::{TaikoGradualDifficulty, TaikoGradualPerformance},
|
||||
Beatmap, DifficultyAttributes, GameMode, PerformanceAttributes, ScoreState,
|
||||
};
|
||||
|
||||
@@ -14,12 +14,12 @@ use crate::{
|
||||
/// On every call of [`Iterator::next`](Iterator::next), the map's next hit object will
|
||||
/// be processed and the [`DifficultyAttributes`] will be updated and returned.
|
||||
///
|
||||
/// If you want to calculate performance attributes, use [`GradualPerformanceAttributes`] instead.
|
||||
/// If you want to calculate performance attributes, use [`GradualPerformance`] instead.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```no_run
|
||||
/// use rosu_pp::{Beatmap, GradualDifficultyAttributes};
|
||||
/// use rosu_pp::{Beatmap, GradualDifficulty};
|
||||
///
|
||||
/// # /*
|
||||
/// let map: Beatmap = ...
|
||||
@@ -27,7 +27,7 @@ use crate::{
|
||||
/// # let map = Beatmap::default();
|
||||
///
|
||||
/// let mods = 64; // DT
|
||||
/// let mut iter = GradualDifficultyAttributes::new(&map, mods);
|
||||
/// let mut iter = GradualDifficulty::new(&map, mods);
|
||||
///
|
||||
/// let attrs1 = iter.next(); // the difficulty of the map after the first hit object
|
||||
/// let attrs2 = iter.next(); // after the second hit object
|
||||
@@ -38,51 +38,51 @@ use crate::{
|
||||
/// }
|
||||
/// ```
|
||||
#[derive(Debug)]
|
||||
pub enum GradualDifficultyAttributes<'map> {
|
||||
pub enum GradualDifficulty<'map> {
|
||||
/// Gradual osu!standard difficulty attributes.
|
||||
Osu(OsuGradualDifficultyAttributes),
|
||||
Osu(OsuGradualDifficulty),
|
||||
/// Gradual osu!taiko difficulty attributes.
|
||||
Taiko(TaikoGradualDifficultyAttributes),
|
||||
Taiko(TaikoGradualDifficulty),
|
||||
/// Gradual osu!catch difficulty attributes.
|
||||
Catch(CatchGradualDifficultyAttributes<'map>),
|
||||
Catch(CatchGradualDifficulty<'map>),
|
||||
/// Gradual osu!mania difficulty attributes.
|
||||
Mania(ManiaGradualDifficultyAttributes<'map>),
|
||||
Mania(ManiaGradualDifficulty<'map>),
|
||||
}
|
||||
|
||||
impl<'map> GradualDifficultyAttributes<'map> {
|
||||
impl<'map> GradualDifficulty<'map> {
|
||||
// FIXME: converted catch maps will always count as osu!std since their mode is not modified
|
||||
/// Create a new gradual difficulty calculator for maps of any mode.
|
||||
#[inline]
|
||||
pub fn new(map: &'map Beatmap, mods: u32) -> Self {
|
||||
match map.mode {
|
||||
GameMode::Osu => Self::Osu(OsuGradualDifficultyAttributes::new(map, mods)),
|
||||
GameMode::Taiko => Self::Taiko(TaikoGradualDifficultyAttributes::new(map, mods)),
|
||||
GameMode::Catch => Self::Catch(CatchGradualDifficultyAttributes::new(map, mods)),
|
||||
GameMode::Mania => Self::Mania(ManiaGradualDifficultyAttributes::new(map, mods)),
|
||||
GameMode::Osu => Self::Osu(OsuGradualDifficulty::new(map, mods)),
|
||||
GameMode::Taiko => Self::Taiko(TaikoGradualDifficulty::new(map, mods)),
|
||||
GameMode::Catch => Self::Catch(CatchGradualDifficulty::new(map, mods)),
|
||||
GameMode::Mania => Self::Mania(ManiaGradualDifficulty::new(map, mods)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Iterator for GradualDifficultyAttributes<'_> {
|
||||
impl Iterator for GradualDifficulty<'_> {
|
||||
type Item = DifficultyAttributes;
|
||||
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
match self {
|
||||
GradualDifficultyAttributes::Osu(o) => o.next().map(DifficultyAttributes::Osu),
|
||||
GradualDifficultyAttributes::Taiko(t) => t.next().map(DifficultyAttributes::Taiko),
|
||||
GradualDifficultyAttributes::Catch(f) => f.next().map(DifficultyAttributes::Catch),
|
||||
GradualDifficultyAttributes::Mania(m) => m.next().map(DifficultyAttributes::Mania),
|
||||
GradualDifficulty::Osu(o) => o.next().map(DifficultyAttributes::Osu),
|
||||
GradualDifficulty::Taiko(t) => t.next().map(DifficultyAttributes::Taiko),
|
||||
GradualDifficulty::Catch(f) => f.next().map(DifficultyAttributes::Catch),
|
||||
GradualDifficulty::Mania(m) => m.next().map(DifficultyAttributes::Mania),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
match self {
|
||||
GradualDifficultyAttributes::Osu(o) => o.size_hint(),
|
||||
GradualDifficultyAttributes::Taiko(t) => t.size_hint(),
|
||||
GradualDifficultyAttributes::Catch(f) => f.size_hint(),
|
||||
GradualDifficultyAttributes::Mania(m) => m.size_hint(),
|
||||
GradualDifficulty::Osu(o) => o.size_hint(),
|
||||
GradualDifficulty::Taiko(t) => t.size_hint(),
|
||||
GradualDifficulty::Catch(f) => f.size_hint(),
|
||||
GradualDifficulty::Mania(m) => m.size_hint(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,15 +101,15 @@ impl Iterator for GradualDifficultyAttributes<'_> {
|
||||
///
|
||||
/// Alternatively, you can match on the map's mode yourself and use the gradual
|
||||
/// performance attribute struct for the corresponding mode, i.e.
|
||||
/// [`OsuGradualPerformanceAttributes`], [`TaikoGradualPerformanceAttributes`],
|
||||
/// [`CatchGradualPerformanceAttributes`], or [`ManiaGradualPerformanceAttributes`].
|
||||
/// [`OsuGradualPerformance`], [`TaikoGradualPerformance`],
|
||||
/// [`CatchGradualPerformance`], or [`ManiaGradualPerformance`].
|
||||
///
|
||||
/// If you only want to calculate difficulty attributes use [`GradualDifficultyAttributes`] instead.
|
||||
/// If you only want to calculate difficulty attributes use [`GradualDifficulty`] instead.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```no_run
|
||||
/// use rosu_pp::{Beatmap, GradualPerformanceAttributes, ScoreState};
|
||||
/// use rosu_pp::{Beatmap, GradualPerformance, ScoreState};
|
||||
///
|
||||
/// # /*
|
||||
/// let map: Beatmap = ...
|
||||
@@ -117,7 +117,7 @@ impl Iterator for GradualDifficultyAttributes<'_> {
|
||||
/// # let map = Beatmap::default();
|
||||
///
|
||||
/// let mods = 64; // DT
|
||||
/// let mut gradual_perf = GradualPerformanceAttributes::new(&map, mods);
|
||||
/// let mut gradual_perf = GradualPerformance::new(&map, mods);
|
||||
/// let mut state = ScoreState::new(); // empty state, everything is on 0.
|
||||
///
|
||||
/// // The first 10 hitresults are 300s
|
||||
@@ -169,27 +169,27 @@ impl Iterator for GradualDifficultyAttributes<'_> {
|
||||
/// ```
|
||||
#[derive(Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GradualPerformanceAttributes<'map> {
|
||||
pub enum GradualPerformance<'map> {
|
||||
/// Gradual osu!standard performance attributes.
|
||||
Osu(OsuGradualPerformanceAttributes<'map>),
|
||||
Osu(OsuGradualPerformance<'map>),
|
||||
/// Gradual osu!taiko performance attributes.
|
||||
Taiko(TaikoGradualPerformanceAttributes<'map>),
|
||||
Taiko(TaikoGradualPerformance<'map>),
|
||||
/// Gradual osu!catch performance attributes.
|
||||
Catch(CatchGradualPerformanceAttributes<'map>),
|
||||
Catch(CatchGradualPerformance<'map>),
|
||||
/// Gradual osu!mania performance attributes.
|
||||
Mania(ManiaGradualPerformanceAttributes<'map>),
|
||||
Mania(ManiaGradualPerformance<'map>),
|
||||
}
|
||||
|
||||
impl<'map> GradualPerformanceAttributes<'map> {
|
||||
impl<'map> GradualPerformance<'map> {
|
||||
// FIXME: converted catch maps will always count as osu!std since their mode is not modified
|
||||
/// Create a new gradual performance calculator for maps of any mode.
|
||||
#[inline]
|
||||
pub fn new(map: &'map Beatmap, mods: u32) -> Self {
|
||||
match map.mode {
|
||||
GameMode::Osu => Self::Osu(OsuGradualPerformanceAttributes::new(map, mods)),
|
||||
GameMode::Taiko => Self::Taiko(TaikoGradualPerformanceAttributes::new(map, mods)),
|
||||
GameMode::Catch => Self::Catch(CatchGradualPerformanceAttributes::new(map, mods)),
|
||||
GameMode::Mania => Self::Mania(ManiaGradualPerformanceAttributes::new(map, mods)),
|
||||
GameMode::Osu => Self::Osu(OsuGradualPerformance::new(map, mods)),
|
||||
GameMode::Taiko => Self::Taiko(TaikoGradualPerformance::new(map, mods)),
|
||||
GameMode::Catch => Self::Catch(CatchGradualPerformance::new(map, mods)),
|
||||
GameMode::Mania => Self::Mania(ManiaGradualPerformance::new(map, mods)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,10 +213,10 @@ impl<'map> GradualPerformanceAttributes<'map> {
|
||||
#[inline]
|
||||
pub fn nth(&mut self, state: ScoreState, n: usize) -> Option<PerformanceAttributes> {
|
||||
match self {
|
||||
GradualPerformanceAttributes::Osu(o) => o.nth(state.into(), n).map(From::from),
|
||||
GradualPerformanceAttributes::Taiko(t) => t.nth(state.into(), n).map(From::from),
|
||||
GradualPerformanceAttributes::Catch(f) => f.nth(state.into(), n).map(From::from),
|
||||
GradualPerformanceAttributes::Mania(m) => m.nth(state.into(), n).map(From::from),
|
||||
GradualPerformance::Osu(o) => o.nth(state.into(), n).map(From::from),
|
||||
GradualPerformance::Taiko(t) => t.nth(state.into(), n).map(From::from),
|
||||
GradualPerformance::Catch(f) => f.nth(state.into(), n).map(From::from),
|
||||
GradualPerformance::Mania(m) => m.nth(state.into(), n).map(From::from),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -79,11 +79,11 @@
|
||||
//! This could be done by using `passed_objects` as the amount of objects that were passed so far.
|
||||
//! However, this requires to recalculate the beginning again and again, we can be more efficient than that.
|
||||
//!
|
||||
//! Instead, you should use [`GradualDifficultyAttributes`] and [`GradualPerformanceAttributes`]:
|
||||
//! Instead, you should use [`GradualDifficulty`] and [`GradualPerformance`]:
|
||||
//!
|
||||
//! ```no_run
|
||||
//! use rosu_pp::{
|
||||
//! Beatmap, BeatmapExt, GradualPerformanceAttributes, ScoreState,
|
||||
//! Beatmap, BeatmapExt, GradualPerformance, ScoreState,
|
||||
//! taiko::TaikoScoreState,
|
||||
//! };
|
||||
//!
|
||||
@@ -138,7 +138,7 @@
|
||||
//! // Instead of starting off with `BeatmapExt::gradual_performance` one could have
|
||||
//! // created the struct via `TaikoGradualPerformanceAttributes::new`.
|
||||
//! let mut gradual_performance = match gradual_performance {
|
||||
//! GradualPerformanceAttributes::Taiko(gradual) => gradual,
|
||||
//! GradualPerformance::Taiko(gradual) => gradual,
|
||||
//! _ => panic!("the map was not taiko but {:?}", map.mode),
|
||||
//! };
|
||||
//!
|
||||
@@ -201,7 +201,7 @@ pub use beatmap::{Beatmap, BeatmapExt, GameMode};
|
||||
#[cfg(feature = "gradual")]
|
||||
mod gradual;
|
||||
#[cfg(feature = "gradual")]
|
||||
pub use gradual::{GradualDifficultyAttributes, GradualPerformanceAttributes};
|
||||
pub use gradual::{GradualDifficulty, GradualPerformance};
|
||||
|
||||
mod pp;
|
||||
pub use pp::{AnyPP, AttributeProvider, HitResultPriority};
|
||||
|
||||
@@ -23,12 +23,12 @@ use super::{
|
||||
/// be processed and the [`ManiaDifficultyAttributes`] will be updated and returned.
|
||||
///
|
||||
/// If you want to calculate performance attributes, use
|
||||
/// [`ManiaGradualPerformanceAttributes`](crate::mania::ManiaGradualPerformanceAttributes) instead.
|
||||
/// [`ManiaGradualPerformanceAttributes`](crate::mania::ManiaGradualPerformance) instead.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use rosu_pp::{Beatmap, mania::ManiaGradualDifficultyAttributes};
|
||||
/// use rosu_pp::{Beatmap, mania::ManiaGradualDifficulty};
|
||||
///
|
||||
/// # /*
|
||||
/// let map: Beatmap = ...
|
||||
@@ -36,7 +36,7 @@ use super::{
|
||||
/// # let map = Beatmap::default();
|
||||
///
|
||||
/// let mods = 64; // DT
|
||||
/// let mut iter = ManiaGradualDifficultyAttributes::new(&map, mods);
|
||||
/// let mut iter = ManiaGradualDifficulty::new(&map, mods);
|
||||
///
|
||||
/// let attrs1 = iter.next(); // the difficulty of the map after the first hit object
|
||||
/// let attrs2 = iter.next(); // after the second hit object
|
||||
@@ -47,7 +47,7 @@ use super::{
|
||||
/// }
|
||||
/// ```
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ManiaGradualDifficultyAttributes<'map> {
|
||||
pub struct ManiaGradualDifficulty<'map> {
|
||||
pub(crate) idx: usize,
|
||||
map: Cow<'map, Beatmap>,
|
||||
hit_window: f64,
|
||||
@@ -57,7 +57,7 @@ pub struct ManiaGradualDifficultyAttributes<'map> {
|
||||
clock_rate: f64,
|
||||
}
|
||||
|
||||
impl<'map> ManiaGradualDifficultyAttributes<'map> {
|
||||
impl<'map> ManiaGradualDifficulty<'map> {
|
||||
/// Create a new difficulty attributes iterator for osu!mania maps.
|
||||
pub fn new(map: &'map Beatmap, mods: u32) -> Self {
|
||||
let map = map.convert_mode(GameMode::Mania);
|
||||
@@ -148,7 +148,7 @@ impl<'map> ManiaGradualDifficultyAttributes<'map> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Iterator for ManiaGradualDifficultyAttributes<'_> {
|
||||
impl Iterator for ManiaGradualDifficulty<'_> {
|
||||
type Item = ManiaDifficultyAttributes;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
@@ -206,7 +206,7 @@ impl Iterator for ManiaGradualDifficultyAttributes<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl ExactSizeIterator for ManiaGradualDifficultyAttributes<'_> {
|
||||
impl ExactSizeIterator for ManiaGradualDifficulty<'_> {
|
||||
#[inline]
|
||||
fn len(&self) -> usize {
|
||||
self.diff_objects.len() + 1 - self.idx
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use crate::{Beatmap, ManiaPP};
|
||||
|
||||
use super::{ManiaGradualDifficultyAttributes, ManiaPerformanceAttributes, ManiaScoreState};
|
||||
use super::{ManiaGradualDifficulty, ManiaPerformanceAttributes, ManiaScoreState};
|
||||
|
||||
/// Gradually calculate the performance attributes of an osu!mania map.
|
||||
///
|
||||
@@ -15,12 +15,12 @@ use super::{ManiaGradualDifficultyAttributes, ManiaPerformanceAttributes, ManiaS
|
||||
/// Be sure the given score is adjusted with respect to mods.
|
||||
///
|
||||
/// If you only want to calculate difficulty attributes use
|
||||
/// [`ManiaGradualDifficultyAttributes`] instead.
|
||||
/// [`ManiaGradualDifficulty`] instead.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use rosu_pp::{Beatmap, mania::{ManiaGradualPerformanceAttributes, ManiaScoreState}};
|
||||
/// use rosu_pp::{Beatmap, mania::{ManiaGradualPerformance, ManiaScoreState}};
|
||||
///
|
||||
/// # /*
|
||||
/// let map: Beatmap = ...
|
||||
@@ -28,7 +28,7 @@ use super::{ManiaGradualDifficultyAttributes, ManiaPerformanceAttributes, ManiaS
|
||||
/// # let map = Beatmap::default();
|
||||
///
|
||||
/// let mods = 64; // DT
|
||||
/// let mut gradual_perf = ManiaGradualPerformanceAttributes::new(&map, mods);
|
||||
/// let mut gradual_perf = ManiaGradualPerformance::new(&map, mods);
|
||||
/// let mut state = ManiaScoreState::new(); // empty state, everything is on 0.
|
||||
///
|
||||
/// // The first 10 hitresults are 320s
|
||||
@@ -77,15 +77,15 @@ use super::{ManiaGradualDifficultyAttributes, ManiaPerformanceAttributes, ManiaS
|
||||
/// assert!(gradual_perf.next(state).is_none());
|
||||
/// ```
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ManiaGradualPerformanceAttributes<'map> {
|
||||
difficulty: ManiaGradualDifficultyAttributes<'map>,
|
||||
pub struct ManiaGradualPerformance<'map> {
|
||||
difficulty: ManiaGradualDifficulty<'map>,
|
||||
performance: ManiaPP<'map>,
|
||||
}
|
||||
|
||||
impl<'map> ManiaGradualPerformanceAttributes<'map> {
|
||||
impl<'map> ManiaGradualPerformance<'map> {
|
||||
/// Create a new gradual performance calculator for osu!mania maps.
|
||||
pub fn new(map: &'map Beatmap, mods: u32) -> Self {
|
||||
let difficulty = ManiaGradualDifficultyAttributes::new(map, mods);
|
||||
let difficulty = ManiaGradualDifficulty::new(map, mods);
|
||||
let performance = ManiaPP::new(map).mods(mods).passed_objects(0);
|
||||
|
||||
Self {
|
||||
|
||||
+2
-3
@@ -17,8 +17,7 @@ pub use self::{mania_object::ManiaObject, pp::*, score_state::ManiaScoreState};
|
||||
|
||||
#[cfg(feature = "gradual")]
|
||||
pub use self::{
|
||||
gradual_difficulty::ManiaGradualDifficultyAttributes,
|
||||
gradual_performance::ManiaGradualPerformanceAttributes,
|
||||
gradual_difficulty::ManiaGradualDifficulty, gradual_performance::ManiaGradualPerformance,
|
||||
};
|
||||
|
||||
pub(crate) use self::mania_object::ObjectParameters;
|
||||
@@ -88,7 +87,7 @@ impl<'map> ManiaStars<'map> {
|
||||
///
|
||||
/// If you want to calculate the difficulty after every few objects, instead of
|
||||
/// using [`ManiaStars`] multiple times with different `passed_objects`, you should use
|
||||
/// [`ManiaGradualDifficultyAttributes`](crate::mania::ManiaGradualDifficultyAttributes).
|
||||
/// [`ManiaGradualDifficultyAttributes`](crate::mania::ManiaGradualDifficulty).
|
||||
#[inline]
|
||||
pub fn passed_objects(mut self, passed_objects: usize) -> Self {
|
||||
self.passed_objects = Some(passed_objects);
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ impl<'map> ManiaPP<'map> {
|
||||
///
|
||||
/// If you want to calculate the performance after every few objects, instead of
|
||||
/// using [`ManiaPP`] multiple times with different `passed_objects`, you should use
|
||||
/// [`ManiaGradualPerformanceAttributes`](crate::mania::ManiaGradualPerformanceAttributes).
|
||||
/// [`ManiaGradualPerformanceAttributes`](crate::mania::ManiaGradualPerformance).
|
||||
#[inline]
|
||||
pub fn passed_objects(mut self, passed_objects: usize) -> Self {
|
||||
self.passed_objects = Some(passed_objects);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// Aggregation for a score's current state i.e. what are the current hitresults.
|
||||
///
|
||||
/// This struct is used for [`ManiaGradualPerformanceAttributes`](crate::mania::ManiaGradualPerformanceAttributes).
|
||||
/// This struct is used for [`ManiaGradualPerformanceAttributes`](crate::mania::ManiaGradualPerformance).
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq)]
|
||||
pub struct ManiaScoreState {
|
||||
/// Amount of current 320s.
|
||||
|
||||
@@ -26,12 +26,12 @@ use super::{
|
||||
/// be processed and the [`OsuDifficultyAttributes`] will be updated and returned.
|
||||
///
|
||||
/// If you want to calculate performance attributes, use
|
||||
/// [`OsuGradualPerformanceAttributes`](crate::osu::OsuGradualPerformanceAttributes) instead.
|
||||
/// [`OsuGradualPerformanceAttributes`](crate::osu::OsuGradualPerformance) instead.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use rosu_pp::{Beatmap, osu::OsuGradualDifficultyAttributes};
|
||||
/// use rosu_pp::{Beatmap, osu::OsuGradualDifficulty};
|
||||
///
|
||||
/// # /*
|
||||
/// let map: Beatmap = ...
|
||||
@@ -39,7 +39,7 @@ use super::{
|
||||
/// # let map = Beatmap::default();
|
||||
///
|
||||
/// let mods = 64; // DT
|
||||
/// let mut iter = OsuGradualDifficultyAttributes::new(&map, mods);
|
||||
/// let mut iter = OsuGradualDifficulty::new(&map, mods);
|
||||
///
|
||||
/// let attrs1 = iter.next(); // the difficulty of the map after the first hit object
|
||||
/// let attrs2 = iter.next(); // after the second hit object
|
||||
@@ -49,7 +49,7 @@ use super::{
|
||||
/// // ...
|
||||
/// }
|
||||
/// ```
|
||||
pub struct OsuGradualDifficultyAttributes {
|
||||
pub struct OsuGradualDifficulty {
|
||||
pub(crate) idx: usize,
|
||||
mods: u32,
|
||||
attrs: OsuDifficultyAttributes,
|
||||
@@ -61,7 +61,7 @@ pub struct OsuGradualDifficultyAttributes {
|
||||
skills: Skills,
|
||||
}
|
||||
|
||||
impl Debug for OsuGradualDifficultyAttributes {
|
||||
impl Debug for OsuGradualDifficulty {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
f.debug_struct("OsuGradualDifficultyAttributes")
|
||||
.field("idx", &self.idx)
|
||||
@@ -72,7 +72,7 @@ impl Debug for OsuGradualDifficultyAttributes {
|
||||
}
|
||||
}
|
||||
|
||||
impl OsuGradualDifficultyAttributes {
|
||||
impl OsuGradualDifficulty {
|
||||
/// Create a new difficulty attributes iterator for osu!standard maps.
|
||||
pub fn new(map: &Beatmap, mods: u32) -> Self {
|
||||
let clock_rate = mods.clock_rate();
|
||||
@@ -216,7 +216,7 @@ fn extend_lifetime(
|
||||
unsafe { mem::transmute(diff_objects) }
|
||||
}
|
||||
|
||||
impl Iterator for OsuGradualDifficultyAttributes {
|
||||
impl Iterator for OsuGradualDifficulty {
|
||||
type Item = OsuDifficultyAttributes;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
@@ -330,7 +330,7 @@ impl Iterator for OsuGradualDifficultyAttributes {
|
||||
}
|
||||
}
|
||||
|
||||
impl ExactSizeIterator for OsuGradualDifficultyAttributes {
|
||||
impl ExactSizeIterator for OsuGradualDifficulty {
|
||||
#[inline]
|
||||
fn len(&self) -> usize {
|
||||
self.diff_objects.len() + 1 - self.idx
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use crate::{Beatmap, OsuPP};
|
||||
|
||||
use super::{OsuGradualDifficultyAttributes, OsuPerformanceAttributes, OsuScoreState};
|
||||
use super::{OsuGradualDifficulty, OsuPerformanceAttributes, OsuScoreState};
|
||||
|
||||
/// Gradually calculate the performance attributes of an osu!standard map.
|
||||
///
|
||||
@@ -15,12 +15,12 @@ use super::{OsuGradualDifficultyAttributes, OsuPerformanceAttributes, OsuScoreSt
|
||||
/// hitresults as well as the maximum combo so far.
|
||||
///
|
||||
/// If you only want to calculate difficulty attributes use
|
||||
/// [`OsuGradualDifficultyAttributes`] instead.
|
||||
/// [`OsuGradualDifficulty`] instead.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use rosu_pp::{Beatmap, osu::{OsuGradualPerformanceAttributes, OsuScoreState}};
|
||||
/// use rosu_pp::{Beatmap, osu::{OsuGradualPerformance, OsuScoreState}};
|
||||
///
|
||||
/// # /*
|
||||
/// let map: Beatmap = ...
|
||||
@@ -28,7 +28,7 @@ use super::{OsuGradualDifficultyAttributes, OsuPerformanceAttributes, OsuScoreSt
|
||||
/// # let map = Beatmap::default();
|
||||
///
|
||||
/// let mods = 64; // DT
|
||||
/// let mut gradual_perf = OsuGradualPerformanceAttributes::new(&map, mods);
|
||||
/// let mut gradual_perf = OsuGradualPerformance::new(&map, mods);
|
||||
/// let mut state = OsuScoreState::new(); // empty state, everything is on 0.
|
||||
///
|
||||
/// // The first 10 hitresults are 300s and there are no sliders for additional combo
|
||||
@@ -91,15 +91,15 @@ use super::{OsuGradualDifficultyAttributes, OsuPerformanceAttributes, OsuScoreSt
|
||||
/// assert!(gradual_perf.next(state).is_none());
|
||||
/// ```
|
||||
#[derive(Debug)]
|
||||
pub struct OsuGradualPerformanceAttributes<'map> {
|
||||
difficulty: OsuGradualDifficultyAttributes,
|
||||
pub struct OsuGradualPerformance<'map> {
|
||||
difficulty: OsuGradualDifficulty,
|
||||
performance: OsuPP<'map>,
|
||||
}
|
||||
|
||||
impl<'map> OsuGradualPerformanceAttributes<'map> {
|
||||
impl<'map> OsuGradualPerformance<'map> {
|
||||
/// Create a new gradual performance calculator for osu!standard maps.
|
||||
pub fn new(map: &'map Beatmap, mods: u32) -> Self {
|
||||
let difficulty = OsuGradualDifficultyAttributes::new(map, mods);
|
||||
let difficulty = OsuGradualDifficulty::new(map, mods);
|
||||
let performance = OsuPP::new(map).mods(mods).passed_objects(0);
|
||||
|
||||
Self {
|
||||
|
||||
+3
-5
@@ -22,8 +22,7 @@ pub use self::{osu_object::*, pp::*, score_state::OsuScoreState};
|
||||
|
||||
#[cfg(feature = "gradual")]
|
||||
pub use self::{
|
||||
gradual_difficulty::OsuGradualDifficultyAttributes,
|
||||
gradual_performance::OsuGradualPerformanceAttributes,
|
||||
gradual_difficulty::OsuGradualDifficulty, gradual_performance::OsuGradualPerformance,
|
||||
};
|
||||
|
||||
pub(crate) use self::scaling_factor::ScalingFactor;
|
||||
@@ -102,7 +101,7 @@ impl<'map> OsuStars<'map> {
|
||||
///
|
||||
/// If you want to calculate the difficulty after every few objects, instead of
|
||||
/// using [`OsuStars`] multiple times with different `passed_objects`, you should use
|
||||
/// [`OsuGradualDifficultyAttributes`].
|
||||
/// [`OsuGradualDifficulty`].
|
||||
#[inline]
|
||||
pub fn passed_objects(mut self, passed_objects: usize) -> Self {
|
||||
self.passed_objects = Some(passed_objects);
|
||||
@@ -326,8 +325,7 @@ fn calculate_skills(params: OsuStars<'_>) -> (Skills, OsuDifficultyAttributes) {
|
||||
|
||||
let curr = curr.into_ref();
|
||||
|
||||
let diff_obj =
|
||||
OsuDifficultyObject::new(curr, last.get_ref(), clock_rate, i, dists);
|
||||
let diff_obj = OsuDifficultyObject::new(curr, last.get_ref(), clock_rate, i, dists);
|
||||
diff_objects.push(diff_obj);
|
||||
|
||||
last_last = Some(last);
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ impl<'map> OsuPP<'map> {
|
||||
///
|
||||
/// If you want to calculate the performance after every few objects, instead of
|
||||
/// using [`OsuPP`] multiple times with different `passed_objects`, you should use
|
||||
/// [`OsuGradualPerformanceAttributes`](crate::osu::OsuGradualPerformanceAttributes).
|
||||
/// [`OsuGradualPerformanceAttributes`](crate::osu::OsuGradualPerformance).
|
||||
#[inline]
|
||||
pub fn passed_objects(mut self, passed_objects: usize) -> Self {
|
||||
self.passed_objects = Some(passed_objects);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// Aggregation for a score's current state i.e. what was the
|
||||
/// maximum combo so far and what are the current hitresults.
|
||||
///
|
||||
/// This struct is used for [`OsuGradualPerformanceAttributes`](crate::osu::OsuGradualPerformanceAttributes).
|
||||
/// This struct is used for [`OsuGradualPerformanceAttributes`](crate::osu::OsuGradualPerformance).
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq)]
|
||||
pub struct OsuScoreState {
|
||||
/// Maximum combo that the score has had so far.
|
||||
|
||||
@@ -116,7 +116,7 @@ impl<'map> AnyPP<'map> {
|
||||
///
|
||||
/// If you want to calculate the performance after every few objects, instead of
|
||||
/// using [`AnyPP`] multiple times with different `passed_objects`, you should use
|
||||
/// [`GradualPerformanceAttributes`](crate::GradualPerformanceAttributes).
|
||||
/// [`GradualPerformanceAttributes`](crate::GradualPerformance).
|
||||
#[inline]
|
||||
pub fn passed_objects(self, passed_objects: usize) -> Self {
|
||||
match self {
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ impl<'map> AnyStars<'map> {
|
||||
///
|
||||
/// If you want to calculate the performance after every few objects, instead of
|
||||
/// using [`AnyStars`] multiple times with different `passed_objects`, you should use
|
||||
/// [`GradualDifficultyAttributes`](crate::GradualDifficultyAttributes).
|
||||
/// [`GradualDifficultyAttributes`](crate::GradualDifficulty).
|
||||
#[inline]
|
||||
pub fn passed_objects(self, passed_objects: usize) -> Self {
|
||||
match self {
|
||||
|
||||
@@ -19,12 +19,12 @@ use super::{
|
||||
/// be processed and the [`TaikoDifficultyAttributes`] will be updated and returned.
|
||||
///
|
||||
/// If you want to calculate performance attributes, use
|
||||
/// [`TaikoGradualPerformanceAttributes`](crate::taiko::TaikoGradualPerformanceAttributes) instead.
|
||||
/// [`TaikoGradualPerformanceAttributes`](crate::taiko::TaikoGradualPerformance) instead.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use rosu_pp::{Beatmap, taiko::TaikoGradualDifficultyAttributes};
|
||||
/// use rosu_pp::{Beatmap, taiko::TaikoGradualDifficulty};
|
||||
///
|
||||
/// # /*
|
||||
/// let map: Beatmap = ...
|
||||
@@ -32,7 +32,7 @@ use super::{
|
||||
/// # let map = Beatmap::default();
|
||||
///
|
||||
/// let mods = 64; // DT
|
||||
/// let mut iter = TaikoGradualDifficultyAttributes::new(&map, mods);
|
||||
/// let mut iter = TaikoGradualDifficulty::new(&map, mods);
|
||||
///
|
||||
/// let attrs1 = iter.next(); // the difficulty of the map after the first hit object
|
||||
/// let attrs2 = iter.next(); // after the second hit object
|
||||
@@ -43,7 +43,7 @@ use super::{
|
||||
/// }
|
||||
/// ```
|
||||
#[derive(Debug)]
|
||||
pub struct TaikoGradualDifficultyAttributes {
|
||||
pub struct TaikoGradualDifficulty {
|
||||
pub(crate) idx: usize,
|
||||
attrs: TaikoDifficultyAttributes,
|
||||
diff_objects: IntoIter<Rc<RefCell<TaikoDifficultyObject>>>,
|
||||
@@ -53,7 +53,7 @@ pub struct TaikoGradualDifficultyAttributes {
|
||||
is_convert: bool,
|
||||
}
|
||||
|
||||
impl TaikoGradualDifficultyAttributes {
|
||||
impl TaikoGradualDifficulty {
|
||||
/// Create a new difficulty attributes iterator for osu!taiko maps.
|
||||
pub fn new(map: &Beatmap, mods: u32) -> Self {
|
||||
let map = map.convert_mode(GameMode::Taiko);
|
||||
@@ -139,7 +139,7 @@ impl TaikoGradualDifficultyAttributes {
|
||||
}
|
||||
}
|
||||
|
||||
impl Iterator for TaikoGradualDifficultyAttributes {
|
||||
impl Iterator for TaikoGradualDifficulty {
|
||||
type Item = TaikoDifficultyAttributes;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
@@ -236,7 +236,7 @@ impl Iterator for TaikoGradualDifficultyAttributes {
|
||||
}
|
||||
}
|
||||
|
||||
impl ExactSizeIterator for TaikoGradualDifficultyAttributes {
|
||||
impl ExactSizeIterator for TaikoGradualDifficulty {
|
||||
#[inline]
|
||||
fn len(&self) -> usize {
|
||||
self.total_hits - self.idx
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use crate::{taiko::TaikoScoreState, Beatmap, TaikoPP};
|
||||
|
||||
use super::{TaikoGradualDifficultyAttributes, TaikoPerformanceAttributes};
|
||||
use super::{TaikoGradualDifficulty, TaikoPerformanceAttributes};
|
||||
|
||||
/// Gradually calculate the performance attributes of an osu!taiko map.
|
||||
///
|
||||
@@ -15,12 +15,12 @@ use super::{TaikoGradualDifficultyAttributes, TaikoPerformanceAttributes};
|
||||
/// hitresults as well as the maximum combo so far.
|
||||
///
|
||||
/// If you only want to calculate difficulty attributes use
|
||||
/// [`TaikoGradualDifficultyAttributes`] instead.
|
||||
/// [`TaikoGradualDifficulty`] instead.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use rosu_pp::{Beatmap, taiko::{TaikoGradualPerformanceAttributes, TaikoScoreState}};
|
||||
/// use rosu_pp::{Beatmap, taiko::{TaikoGradualPerformance, TaikoScoreState}};
|
||||
///
|
||||
/// # /*
|
||||
/// let map: Beatmap = ...
|
||||
@@ -28,7 +28,7 @@ use super::{TaikoGradualDifficultyAttributes, TaikoPerformanceAttributes};
|
||||
/// # let map = Beatmap::default();
|
||||
///
|
||||
/// let mods = 64; // DT
|
||||
/// let mut gradual_perf = TaikoGradualPerformanceAttributes::new(&map, mods);
|
||||
/// let mut gradual_perf = TaikoGradualPerformance::new(&map, mods);
|
||||
/// let mut state = TaikoScoreState::new(); // empty state, everything is on 0.
|
||||
///
|
||||
/// // The first 10 hitresults are 300s
|
||||
@@ -89,15 +89,15 @@ use super::{TaikoGradualDifficultyAttributes, TaikoPerformanceAttributes};
|
||||
/// assert!(gradual_perf.next(state).is_none());
|
||||
/// ```
|
||||
#[derive(Debug)]
|
||||
pub struct TaikoGradualPerformanceAttributes<'map> {
|
||||
difficulty: TaikoGradualDifficultyAttributes,
|
||||
pub struct TaikoGradualPerformance<'map> {
|
||||
difficulty: TaikoGradualDifficulty,
|
||||
performance: TaikoPP<'map>,
|
||||
}
|
||||
|
||||
impl<'map> TaikoGradualPerformanceAttributes<'map> {
|
||||
impl<'map> TaikoGradualPerformance<'map> {
|
||||
/// Create a new gradual performance calculator for osu!taiko maps.
|
||||
pub fn new(map: &'map Beatmap, mods: u32) -> Self {
|
||||
let difficulty = TaikoGradualDifficultyAttributes::new(map, mods);
|
||||
let difficulty = TaikoGradualDifficulty::new(map, mods);
|
||||
let performance = TaikoPP::new(map).mods(mods).passed_objects(0);
|
||||
|
||||
Self {
|
||||
|
||||
+2
-3
@@ -17,8 +17,7 @@ pub use self::{pp::*, score_state::TaikoScoreState, taiko_object::TaikoObjectPub
|
||||
|
||||
#[cfg(feature = "gradual")]
|
||||
pub use self::{
|
||||
gradual_difficulty::TaikoGradualDifficultyAttributes,
|
||||
gradual_performance::TaikoGradualPerformanceAttributes,
|
||||
gradual_difficulty::TaikoGradualDifficulty, gradual_performance::TaikoGradualPerformance,
|
||||
};
|
||||
|
||||
pub(crate) use self::taiko_object::IntoTaikoObjectIter;
|
||||
@@ -92,7 +91,7 @@ impl<'map> TaikoStars<'map> {
|
||||
///
|
||||
/// If you want to calculate the difficulty after every few objects, instead of
|
||||
/// using [`TaikoStars`] multiple times with different `passed_objects`, you should use
|
||||
/// [`TaikoGradualDifficultyAttributes`](crate::taiko::TaikoGradualDifficultyAttributes).
|
||||
/// [`TaikoGradualDifficultyAttributes`](crate::taiko::TaikoGradualDifficulty).
|
||||
#[inline]
|
||||
pub fn passed_objects(mut self, passed_objects: usize) -> Self {
|
||||
self.passed_objects = Some(passed_objects);
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ impl<'map> TaikoPP<'map> {
|
||||
///
|
||||
/// If you want to calculate the performance after every few objects, instead of
|
||||
/// using [`TaikoPP`] multiple times with different `passed_objects`, you should use
|
||||
/// [`TaikoGradualPerformanceAttributes`](crate::taiko::TaikoGradualPerformanceAttributes).
|
||||
/// [`TaikoGradualPerformanceAttributes`](crate::taiko::TaikoGradualPerformance).
|
||||
#[inline]
|
||||
pub fn passed_objects(mut self, passed_objects: usize) -> Self {
|
||||
self.passed_objects = Some(passed_objects);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// Aggregation for a score's current state i.e. what was the
|
||||
/// maximum combo so far and what are the current hitresults.
|
||||
///
|
||||
/// This struct is used for [`TaikoGradualPerformanceAttributes`](crate::taiko::TaikoGradualPerformanceAttributes).
|
||||
/// This struct is used for [`TaikoGradualPerformanceAttributes`](crate::taiko::TaikoGradualPerformance).
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq)]
|
||||
pub struct TaikoScoreState {
|
||||
/// Maximum combo that the score has had so far.
|
||||
|
||||
+12
-9
@@ -1,7 +1,10 @@
|
||||
#![cfg(all(not(any(feature = "async_tokio", feature = "async_std")), feature = "gradual"))]
|
||||
#![cfg(all(
|
||||
not(any(feature = "async_tokio", feature = "async_std")),
|
||||
feature = "gradual"
|
||||
))]
|
||||
|
||||
use rosu_pp::{
|
||||
catch::{CatchGradualDifficultyAttributes, CatchGradualPerformanceAttributes, CatchScoreState},
|
||||
catch::{CatchGradualDifficulty, CatchGradualPerformance, CatchScoreState},
|
||||
Beatmap, CatchPP, CatchStars,
|
||||
};
|
||||
|
||||
@@ -12,7 +15,7 @@ mod common;
|
||||
#[test]
|
||||
fn empty_map() {
|
||||
let map = Beatmap::default();
|
||||
let mut attributes = CatchGradualDifficultyAttributes::new(&map, 0);
|
||||
let mut attributes = CatchGradualDifficulty::new(&map, 0);
|
||||
|
||||
assert!(attributes.next().is_none());
|
||||
}
|
||||
@@ -22,7 +25,7 @@ fn iter_end_eq_regular() {
|
||||
let map = test_map!(Catch);
|
||||
let regular = CatchStars::new(&map).calculate();
|
||||
|
||||
let iter_end = CatchGradualDifficultyAttributes::new(&map, 0)
|
||||
let iter_end = CatchGradualDifficulty::new(&map, 0)
|
||||
.last()
|
||||
.expect("empty iter");
|
||||
|
||||
@@ -32,7 +35,7 @@ fn iter_end_eq_regular() {
|
||||
#[test]
|
||||
fn correct_empty() {
|
||||
let map = test_map!(Catch);
|
||||
let mut gradual = CatchGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual = CatchGradualPerformance::new(&map, 0);
|
||||
let state = CatchScoreState::default();
|
||||
|
||||
let first_attrs = gradual.nth(state.clone(), usize::MAX);
|
||||
@@ -46,8 +49,8 @@ fn next_and_next_n() {
|
||||
let map = test_map!(Catch);
|
||||
let state = CatchScoreState::default();
|
||||
|
||||
let mut gradual1 = CatchGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual2 = CatchGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual1 = CatchGradualPerformance::new(&map, 0);
|
||||
let mut gradual2 = CatchGradualPerformance::new(&map, 0);
|
||||
|
||||
for _ in 0..20 {
|
||||
let _ = gradual1.next(state.clone());
|
||||
@@ -80,7 +83,7 @@ fn gradual_end_eq_regular() {
|
||||
let map = test_map!(Catch);
|
||||
let regular = CatchPP::new(&map).calculate();
|
||||
|
||||
let mut gradual = CatchGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual = CatchGradualPerformance::new(&map, 0);
|
||||
|
||||
let state = CatchScoreState {
|
||||
max_combo: 730,
|
||||
@@ -102,7 +105,7 @@ fn gradual_eq_regular_passed() {
|
||||
let n = 100;
|
||||
|
||||
let regular = CatchPP::new(&map).passed_objects(n).calculate();
|
||||
let mut gradual = CatchGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual = CatchGradualPerformance::new(&map, 0);
|
||||
|
||||
let state = CatchScoreState {
|
||||
max_combo: 101,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
))]
|
||||
|
||||
use rosu_pp::{
|
||||
mania::{ManiaGradualDifficultyAttributes, ManiaGradualPerformanceAttributes, ManiaScoreState},
|
||||
mania::{ManiaGradualDifficulty, ManiaGradualPerformance, ManiaScoreState},
|
||||
Beatmap, ManiaPP, ManiaStars,
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ mod common;
|
||||
#[test]
|
||||
fn empty_map() {
|
||||
let map = Beatmap::default();
|
||||
let mut attributes = ManiaGradualDifficultyAttributes::new(&map, 0);
|
||||
let mut attributes = ManiaGradualDifficulty::new(&map, 0);
|
||||
|
||||
assert!(attributes.next().is_none());
|
||||
}
|
||||
@@ -25,7 +25,7 @@ fn iter_end_eq_regular() {
|
||||
let map = test_map!(Mania);
|
||||
let regular = ManiaStars::new(&map).calculate();
|
||||
|
||||
let iter_end = ManiaGradualDifficultyAttributes::new(&map, 0)
|
||||
let iter_end = ManiaGradualDifficulty::new(&map, 0)
|
||||
.last()
|
||||
.expect("empty iter");
|
||||
|
||||
@@ -35,7 +35,7 @@ fn iter_end_eq_regular() {
|
||||
#[test]
|
||||
fn correct_empty() {
|
||||
let map = test_map!(Mania);
|
||||
let mut gradual = ManiaGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual = ManiaGradualPerformance::new(&map, 0);
|
||||
|
||||
let state = ManiaScoreState::default();
|
||||
|
||||
@@ -51,8 +51,8 @@ fn next_and_next_n() {
|
||||
|
||||
let mut state = ManiaScoreState::default();
|
||||
|
||||
let mut gradual1 = ManiaGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual2 = ManiaGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual1 = ManiaGradualPerformance::new(&map, 0);
|
||||
let mut gradual2 = ManiaGradualPerformance::new(&map, 0);
|
||||
|
||||
for _ in 0..20 {
|
||||
let _ = gradual1.next(state.clone());
|
||||
@@ -78,7 +78,7 @@ fn gradual_end_eq_regular() {
|
||||
let map = test_map!(Mania);
|
||||
let regular = ManiaPP::new(&map).calculate();
|
||||
|
||||
let mut gradual = ManiaGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual = ManiaGradualPerformance::new(&map, 0);
|
||||
|
||||
let state = ManiaScoreState {
|
||||
n320: map.hit_objects.len(),
|
||||
@@ -105,7 +105,7 @@ fn gradual_eq_regular_passed() {
|
||||
.state(state.clone())
|
||||
.calculate();
|
||||
|
||||
let gradual = ManiaGradualPerformanceAttributes::new(&map, 0)
|
||||
let gradual = ManiaGradualPerformance::new(&map, 0)
|
||||
.nth(state, n - 1)
|
||||
.unwrap();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
))]
|
||||
|
||||
use rosu_pp::{
|
||||
osu::{OsuGradualDifficultyAttributes, OsuGradualPerformanceAttributes, OsuScoreState},
|
||||
osu::{OsuGradualDifficulty, OsuGradualPerformance, OsuScoreState},
|
||||
Beatmap, OsuPP, OsuStars,
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ mod common;
|
||||
#[test]
|
||||
fn empty_map() {
|
||||
let map = Beatmap::default();
|
||||
let mut attributes = OsuGradualDifficultyAttributes::new(&map, 0);
|
||||
let mut attributes = OsuGradualDifficulty::new(&map, 0);
|
||||
|
||||
assert!(attributes.next().is_none());
|
||||
}
|
||||
@@ -25,7 +25,7 @@ fn iter_end_eq_regular() {
|
||||
let map = test_map!(Osu);
|
||||
let regular = OsuStars::new(&map).calculate();
|
||||
|
||||
let iter_end = OsuGradualDifficultyAttributes::new(&map, 0)
|
||||
let iter_end = OsuGradualDifficulty::new(&map, 0)
|
||||
.last()
|
||||
.expect("empty iter");
|
||||
|
||||
@@ -35,7 +35,7 @@ fn iter_end_eq_regular() {
|
||||
#[test]
|
||||
fn correct_empty() {
|
||||
let map = test_map!(Osu);
|
||||
let mut gradual = OsuGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual = OsuGradualPerformance::new(&map, 0);
|
||||
let state = OsuScoreState::default();
|
||||
|
||||
let first_attrs = gradual.nth(state.clone(), usize::MAX);
|
||||
@@ -49,8 +49,8 @@ fn next_and_next_n() {
|
||||
let map = test_map!(Osu);
|
||||
let state = OsuScoreState::default();
|
||||
|
||||
let mut gradual1 = OsuGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual2 = OsuGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual1 = OsuGradualPerformance::new(&map, 0);
|
||||
let mut gradual2 = OsuGradualPerformance::new(&map, 0);
|
||||
|
||||
for _ in 0..20 {
|
||||
let _ = gradual1.next(state.clone());
|
||||
@@ -81,7 +81,7 @@ fn next_and_next_n() {
|
||||
fn gradual_end_eq_regular() {
|
||||
let map = test_map!(Osu);
|
||||
let regular = OsuPP::new(&map).calculate();
|
||||
let mut gradual = OsuGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual = OsuGradualPerformance::new(&map, 0);
|
||||
|
||||
let state = OsuScoreState {
|
||||
max_combo: 909,
|
||||
@@ -102,7 +102,7 @@ fn gradual_eq_regular_passed() {
|
||||
let n = 100;
|
||||
|
||||
let regular = OsuPP::new(&map).passed_objects(n).calculate();
|
||||
let mut gradual = OsuGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual = OsuGradualPerformance::new(&map, 0);
|
||||
|
||||
let state = OsuScoreState {
|
||||
max_combo: 122,
|
||||
|
||||
+12
-9
@@ -1,7 +1,10 @@
|
||||
#![cfg(all(not(any(feature = "async_tokio", feature = "async_std")), feature = "gradual"))]
|
||||
#![cfg(all(
|
||||
not(any(feature = "async_tokio", feature = "async_std")),
|
||||
feature = "gradual"
|
||||
))]
|
||||
|
||||
use rosu_pp::{
|
||||
taiko::{TaikoGradualDifficultyAttributes, TaikoGradualPerformanceAttributes, TaikoScoreState},
|
||||
taiko::{TaikoGradualDifficulty, TaikoGradualPerformance, TaikoScoreState},
|
||||
Beatmap, TaikoPP, TaikoStars,
|
||||
};
|
||||
|
||||
@@ -12,7 +15,7 @@ mod common;
|
||||
#[test]
|
||||
fn empty_map() {
|
||||
let map = Beatmap::default();
|
||||
let mut attrs = TaikoGradualDifficultyAttributes::new(&map, 0);
|
||||
let mut attrs = TaikoGradualDifficulty::new(&map, 0);
|
||||
|
||||
assert!(attrs.next().is_none());
|
||||
}
|
||||
@@ -22,7 +25,7 @@ fn iter_end_eq_regular() {
|
||||
let map = test_map!(Taiko);
|
||||
let regular = TaikoStars::new(&map).calculate();
|
||||
|
||||
let iter_end = TaikoGradualDifficultyAttributes::new(&map, 0)
|
||||
let iter_end = TaikoGradualDifficulty::new(&map, 0)
|
||||
.last()
|
||||
.expect("empty iter");
|
||||
|
||||
@@ -32,7 +35,7 @@ fn iter_end_eq_regular() {
|
||||
#[test]
|
||||
fn correct_empty() {
|
||||
let map = test_map!(Taiko);
|
||||
let mut gradual = TaikoGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual = TaikoGradualPerformance::new(&map, 0);
|
||||
let state = TaikoScoreState::default();
|
||||
|
||||
let first_attrs = gradual.nth(state.clone(), usize::MAX);
|
||||
@@ -46,8 +49,8 @@ fn next_and_next_n() {
|
||||
let map = test_map!(Taiko);
|
||||
let state = TaikoScoreState::default();
|
||||
|
||||
let mut gradual1 = TaikoGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual2 = TaikoGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual1 = TaikoGradualPerformance::new(&map, 0);
|
||||
let mut gradual2 = TaikoGradualPerformance::new(&map, 0);
|
||||
|
||||
for _ in 0..50 {
|
||||
let _ = gradual1.next(state.clone());
|
||||
@@ -77,7 +80,7 @@ fn next_and_next_n() {
|
||||
fn gradual_end_eq_regular() {
|
||||
let map = test_map!(Taiko);
|
||||
let regular = TaikoPP::new(&map).calculate();
|
||||
let mut gradual = TaikoGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual = TaikoGradualPerformance::new(&map, 0);
|
||||
|
||||
let state = TaikoScoreState {
|
||||
max_combo: 289,
|
||||
@@ -97,7 +100,7 @@ fn gradual_eq_regular_passed() {
|
||||
let n = 250;
|
||||
|
||||
let regular = TaikoPP::new(&map).passed_objects(n).calculate();
|
||||
let mut gradual = TaikoGradualPerformanceAttributes::new(&map, 0);
|
||||
let mut gradual = TaikoGradualPerformance::new(&map, 0);
|
||||
|
||||
let state = TaikoScoreState {
|
||||
max_combo: 250,
|
||||
|
||||
Reference in New Issue
Block a user