docs & clippy adjustment
This commit is contained in:
+6
-2
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
# v0.2.0
|
# v0.2.0
|
||||||
|
|
||||||
- Async beatmap parsing through features `async_tokio` or `async_std`
|
- Async beatmap parsing through features `async_tokio` or `async_std` ([#1] - [@Pure-Peace])
|
||||||
- Hide various parsing related types further inwards, i.e. `rosu_pp::parse::some_type` instead of `rosu_pp::some_type`
|
- Hide various parsing related types further inwards, i.e. `rosu_pp::parse::some_type` instead of `rosu_pp::some_type`
|
||||||
- Affected types: `DifficultyPoint`, `HitObject`, `Pos2`, `TimingPoint`, `HitObjectKind`, `PathType`, `HitSound`
|
- Affected types: `DifficultyPoint`, `HitObject`, `Pos2`, `TimingPoint`, `HitObjectKind`, `PathType`, `HitSound`
|
||||||
|
|
||||||
@@ -25,4 +25,8 @@
|
|||||||
- Fixed passed objects in star calculation
|
- Fixed passed objects in star calculation
|
||||||
|
|
||||||
- mania:
|
- mania:
|
||||||
- Fixed pp calculation on HR
|
- Fixed pp calculation on HR
|
||||||
|
|
||||||
|
[@Pure-Peace]: https://github.com/Pure-Peace
|
||||||
|
|
||||||
|
[#1]: https://github.com/MaxOhn/rosu-pp/pull/1
|
||||||
@@ -27,9 +27,8 @@ let map = match Beatmap::parse(file) {
|
|||||||
|
|
||||||
// If `BeatmapExt` is included, you can make use of
|
// If `BeatmapExt` is included, you can make use of
|
||||||
// some methods on `Beatmap` to make your life simpler.
|
// some methods on `Beatmap` to make your life simpler.
|
||||||
// However, to calculate specific pp values, it is recommended
|
// If the mode is known, it is recommended to use the
|
||||||
// to match on the map's mode yourself and modify the mode's
|
// mode's pp calculator, e.g. `TaikoPP`, manually.
|
||||||
// pp calculator, e.g. `TaikoPP`, manually.
|
|
||||||
let result = map.pp()
|
let result = map.pp()
|
||||||
.mods(24) // HDHR
|
.mods(24) // HDHR
|
||||||
.combo(1234)
|
.combo(1234)
|
||||||
@@ -109,8 +108,8 @@ println!("PP: {}", result.pp());
|
|||||||
| `no_leniency` | When calculating difficulty attributes in osu!standard, ignore stack leniency but consider sliders. Solid middleground between performance and precision, hence the default version. |
|
| `no_leniency` | When calculating difficulty attributes in osu!standard, ignore stack leniency but consider sliders. Solid middleground between performance and precision, hence the default version. |
|
||||||
| `no_sliders_no_leniency` | When calculating difficulty attributes in osu!standard, ignore stack leniency and sliders. Best performance but slightly less precision than `no_leniency`. |
|
| `no_sliders_no_leniency` | When calculating difficulty attributes in osu!standard, ignore stack leniency and sliders. Best performance but slightly less precision than `no_leniency`. |
|
||||||
| `all_included` | When calculating difficulty attributes in osu!standard, consider both stack leniency and sliders. Best precision but significantly worse performance than `no_leniency`. |
|
| `all_included` | When calculating difficulty attributes in osu!standard, consider both stack leniency and sliders. Best precision but significantly worse performance than `no_leniency`. |
|
||||||
| `async_tokio` | Beatmap parsing will be async through a [tokio](https://github.com/tokio-rs/tokio) runtime |
|
| `async_tokio` | Beatmap parsing will be async through [tokio](https://github.com/tokio-rs/tokio) |
|
||||||
| `async_std` | Beatmap parsing will be async through an [async-std](https://github.com/async-rs/async-std) runtime |
|
| `async_std` | Beatmap parsing will be async through [async-std](https://github.com/async-rs/async-std) |
|
||||||
|
|
||||||
### Benchmarks
|
### Benchmarks
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ use crate::{Beatmap, Mods, PpResult, StarResult};
|
|||||||
/// println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());
|
/// println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
pub struct FruitsPP<'m> {
|
pub struct FruitsPP<'m> {
|
||||||
map: &'m Beatmap,
|
map: &'m Beatmap,
|
||||||
attributes: Option<DifficultyAttributes>,
|
attributes: Option<DifficultyAttributes>,
|
||||||
|
|||||||
+6
-8
@@ -27,9 +27,8 @@
|
|||||||
//!
|
//!
|
||||||
//! // If `BeatmapExt` is included, you can make use of
|
//! // If `BeatmapExt` is included, you can make use of
|
||||||
//! // some methods on `Beatmap` to make your life simpler.
|
//! // some methods on `Beatmap` to make your life simpler.
|
||||||
//! // However, to calculate specific pp values, it is recommended
|
//! // If the mode is known, it is recommended to use the
|
||||||
//! // to match on the map's mode yourself and modify the mode's
|
//! // mode's pp calculator, e.g. `TaikoPP`, manually.
|
||||||
//! // pp calculator, e.g. `TaikoPP`, manually.
|
|
||||||
//! let result = map.pp()
|
//! let result = map.pp()
|
||||||
//! .mods(24) // HDHR
|
//! .mods(24) // HDHR
|
||||||
//! .combo(1234)
|
//! .combo(1234)
|
||||||
@@ -114,8 +113,8 @@
|
|||||||
//! | `no_leniency` | When calculating difficulty attributes in osu!standard, ignore stack leniency but consider sliders. Solid middleground between performance and precision, hence the default version. |
|
//! | `no_leniency` | When calculating difficulty attributes in osu!standard, ignore stack leniency but consider sliders. Solid middleground between performance and precision, hence the default version. |
|
||||||
//! | `no_sliders_no_leniency` | When calculating difficulty attributes in osu!standard, ignore stack leniency and sliders. Best performance but slightly less precision than `no_leniency`. |
|
//! | `no_sliders_no_leniency` | When calculating difficulty attributes in osu!standard, ignore stack leniency and sliders. Best performance but slightly less precision than `no_leniency`. |
|
||||||
//! | `all_included` | When calculating difficulty attributes in osu!standard, consider both stack leniency and sliders. Best precision but significantly worse performance than `no_leniency`. |
|
//! | `all_included` | When calculating difficulty attributes in osu!standard, consider both stack leniency and sliders. Best precision but significantly worse performance than `no_leniency`. |
|
||||||
//! | `async_tokio` | Beatmap parsing will be async through a [tokio](https://github.com/tokio-rs/tokio) runtime |
|
//! | `async_tokio` | Beatmap parsing will be async through [tokio](https://github.com/tokio-rs/tokio) |
|
||||||
//! | `async_std` | Beatmap parsing will be async through an [async-std](https://github.com/async-rs/async-std) runtime |
|
//! | `async_std` | Beatmap parsing will be async through [async-std](https://github.com/async-rs/async-std) |
|
||||||
//!
|
//!
|
||||||
//! ## Roadmap
|
//! ## Roadmap
|
||||||
//!
|
//!
|
||||||
@@ -192,10 +191,9 @@ pub trait BeatmapExt {
|
|||||||
/// mode and use the mode's corresponding calculator, e.g. [`TaikoPP`](crate::TaikoPP) for taiko.
|
/// mode and use the mode's corresponding calculator, e.g. [`TaikoPP`](crate::TaikoPP) for taiko.
|
||||||
fn max_pp(&self, mods: u32) -> PpResult;
|
fn max_pp(&self, mods: u32) -> PpResult;
|
||||||
|
|
||||||
/// Returns a builder to calculate a pp value.
|
/// Returns a builder to calculate pp and difficulty values.
|
||||||
///
|
///
|
||||||
/// Although this method is not terribly bad, it is recommended to match on the
|
/// Convenient method that matches on the map's mode to choose the appropriate calculator.
|
||||||
/// map's mode yourself and construct the pp builder accordingly.
|
|
||||||
fn pp(&self) -> AnyPP;
|
fn pp(&self) -> AnyPP;
|
||||||
|
|
||||||
/// Calculate the strains of a map.
|
/// Calculate the strains of a map.
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ use crate::{Beatmap, Mods, PpResult, StarResult};
|
|||||||
/// println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());
|
/// println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
pub struct ManiaPP<'m> {
|
pub struct ManiaPP<'m> {
|
||||||
map: &'m Beatmap,
|
map: &'m Beatmap,
|
||||||
stars: Option<f32>,
|
stars: Option<f32>,
|
||||||
|
|||||||
+1
-4
@@ -29,6 +29,7 @@ use crate::{Beatmap, Mods, PpResult, StarResult};
|
|||||||
/// println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());
|
/// println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
pub struct OsuPP<'m> {
|
pub struct OsuPP<'m> {
|
||||||
map: &'m Beatmap,
|
map: &'m Beatmap,
|
||||||
attributes: Option<DifficultyAttributes>,
|
attributes: Option<DifficultyAttributes>,
|
||||||
@@ -261,10 +262,6 @@ impl<'m> OsuPP<'m> {
|
|||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns an object which contains the pp and [`DifficultyAttributes`](crate::osu::DifficultyAttributes)
|
|
||||||
/// containing stars and other attributes.
|
|
||||||
///
|
|
||||||
/// `stars_func` will be used to calculate the difficulty attributes if they are not yet given.
|
|
||||||
fn calculate_with_func(
|
fn calculate_with_func(
|
||||||
mut self,
|
mut self,
|
||||||
stars_func: impl FnOnce(&Beatmap, u32, Option<usize>) -> StarResult,
|
stars_func: impl FnOnce(&Beatmap, u32, Option<usize>) -> StarResult,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
//! The positional offset of notes created by stack leniency is not considered.
|
//! The positional offset of notes created by stack leniency is not considered.
|
||||||
//! This means the jump distance inbetween notes might be slightly off, resulting in small inaccuracies.
|
//! This means the jump distance inbetween notes might be slightly off, resulting in small inaccuracies.
|
||||||
//! Since calculating these offsets is relatively expensive though, this version is faster than `all_included`.
|
//! Since calculating these offsets is relatively expensive though,
|
||||||
|
//! this version is generally faster than `all_included`.
|
||||||
|
|
||||||
#![cfg(feature = "no_leniency")]
|
#![cfg(feature = "no_leniency")]
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! In addtion to not considering the positional offset caused by stack leniency, slider paths are also ignored.
|
//! In addtion to not considering the positional offset caused by stack leniency, slider paths are also ignored.
|
||||||
//! This means the travel distance of notes is completely omitted which may cause further inaccuracies.
|
//! This means the travel distance of notes is completely omitted which may cause further inaccuracies.
|
||||||
//! Since the slider paths don't have to be computed though, it should generally be faster than `no_leniency`.
|
//! Since the slider paths don't have to be computed though, it is generally faster than `no_leniency`.
|
||||||
|
|
||||||
#![cfg(feature = "no_sliders_no_leniency")]
|
#![cfg(feature = "no_sliders_no_leniency")]
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ use std::num::{ParseFloatError, ParseIntError};
|
|||||||
pub type ParseResult<T> = Result<T, ParseError>;
|
pub type ParseResult<T> = Result<T, ParseError>;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
pub enum ParseError {
|
pub enum ParseError {
|
||||||
IOError(IOError),
|
IOError(IOError),
|
||||||
IncorrectFileHeader,
|
IncorrectFileHeader,
|
||||||
|
|||||||
@@ -659,6 +659,7 @@ macro_rules! parse {
|
|||||||
|
|
||||||
/// The mode of a beatmap.
|
/// The mode of a beatmap.
|
||||||
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
|
||||||
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
pub enum GameMode {
|
pub enum GameMode {
|
||||||
STD = 0,
|
STD = 0,
|
||||||
TKO = 1,
|
TKO = 1,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use crate::OsuPP;
|
|||||||
use crate::TaikoPP;
|
use crate::TaikoPP;
|
||||||
|
|
||||||
/// Calculator for pp on maps of any mode.
|
/// Calculator for pp on maps of any mode.
|
||||||
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
pub enum AnyPP<'m> {
|
pub enum AnyPP<'m> {
|
||||||
#[cfg(feature = "fruits")]
|
#[cfg(feature = "fruits")]
|
||||||
Fruits(FruitsPP<'m>),
|
Fruits(FruitsPP<'m>),
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ use crate::{Beatmap, Mods, PpResult, StarResult};
|
|||||||
/// println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());
|
/// println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
pub struct TaikoPP<'m> {
|
pub struct TaikoPP<'m> {
|
||||||
map: &'m Beatmap,
|
map: &'m Beatmap,
|
||||||
stars: Option<f32>,
|
stars: Option<f32>,
|
||||||
|
|||||||
Reference in New Issue
Block a user