docs & clippy adjustment

This commit is contained in:
MaxOhn
2021-04-17 16:38:12 +02:00
parent 3f81f18c75
commit 17426b9975
12 changed files with 26 additions and 21 deletions
+6 -2
View File
@@ -5,7 +5,7 @@
# 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`
- Affected types: `DifficultyPoint`, `HitObject`, `Pos2`, `TimingPoint`, `HitObjectKind`, `PathType`, `HitSound`
@@ -25,4 +25,8 @@
- Fixed passed objects in star calculation
- 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
+4 -5
View File
@@ -27,9 +27,8 @@ let map = match Beatmap::parse(file) {
// If `BeatmapExt` is included, you can make use of
// some methods on `Beatmap` to make your life simpler.
// However, to calculate specific pp values, it is recommended
// to match on the map's mode yourself and modify the mode's
// pp calculator, e.g. `TaikoPP`, manually.
// If the mode is known, it is recommended to use the
// mode's pp calculator, e.g. `TaikoPP`, manually.
let result = map.pp()
.mods(24) // HDHR
.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_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`. |
| `async_tokio` | Beatmap parsing will be async through a [tokio](https://github.com/tokio-rs/tokio) runtime |
| `async_std` | Beatmap parsing will be async through an [async-std](https://github.com/async-rs/async-std) runtime |
| `async_tokio` | Beatmap parsing will be async through [tokio](https://github.com/tokio-rs/tokio) |
| `async_std` | Beatmap parsing will be async through [async-std](https://github.com/async-rs/async-std) |
### Benchmarks
+1
View File
@@ -29,6 +29,7 @@ use crate::{Beatmap, Mods, PpResult, StarResult};
/// println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());
/// ```
#[derive(Clone, Debug)]
#[allow(clippy::upper_case_acronyms)]
pub struct FruitsPP<'m> {
map: &'m Beatmap,
attributes: Option<DifficultyAttributes>,
+6 -8
View File
@@ -27,9 +27,8 @@
//!
//! // If `BeatmapExt` is included, you can make use of
//! // some methods on `Beatmap` to make your life simpler.
//! // However, to calculate specific pp values, it is recommended
//! // to match on the map's mode yourself and modify the mode's
//! // pp calculator, e.g. `TaikoPP`, manually.
//! // If the mode is known, it is recommended to use the
//! // mode's pp calculator, e.g. `TaikoPP`, manually.
//! let result = map.pp()
//! .mods(24) // HDHR
//! .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_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`. |
//! | `async_tokio` | Beatmap parsing will be async through a [tokio](https://github.com/tokio-rs/tokio) runtime |
//! | `async_std` | Beatmap parsing will be async through an [async-std](https://github.com/async-rs/async-std) runtime |
//! | `async_tokio` | Beatmap parsing will be async through [tokio](https://github.com/tokio-rs/tokio) |
//! | `async_std` | Beatmap parsing will be async through [async-std](https://github.com/async-rs/async-std) |
//!
//! ## Roadmap
//!
@@ -192,10 +191,9 @@ pub trait BeatmapExt {
/// mode and use the mode's corresponding calculator, e.g. [`TaikoPP`](crate::TaikoPP) for taiko.
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
/// map's mode yourself and construct the pp builder accordingly.
/// Convenient method that matches on the map's mode to choose the appropriate calculator.
fn pp(&self) -> AnyPP;
/// Calculate the strains of a map.
+1
View File
@@ -27,6 +27,7 @@ use crate::{Beatmap, Mods, PpResult, StarResult};
/// println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());
/// ```
#[derive(Clone, Debug)]
#[allow(clippy::upper_case_acronyms)]
pub struct ManiaPP<'m> {
map: &'m Beatmap,
stars: Option<f32>,
+1 -4
View File
@@ -29,6 +29,7 @@ use crate::{Beatmap, Mods, PpResult, StarResult};
/// println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());
/// ```
#[derive(Clone, Debug)]
#[allow(clippy::upper_case_acronyms)]
pub struct OsuPP<'m> {
map: &'m Beatmap,
attributes: Option<DifficultyAttributes>,
@@ -261,10 +262,6 @@ impl<'m> OsuPP<'m> {
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(
mut self,
stars_func: impl FnOnce(&Beatmap, u32, Option<usize>) -> StarResult,
+2 -1
View File
@@ -1,6 +1,7 @@
//! 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.
//! 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")]
@@ -1,6 +1,6 @@
//! 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.
//! 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")]
+1
View File
@@ -16,6 +16,7 @@ use std::num::{ParseFloatError, ParseIntError};
pub type ParseResult<T> = Result<T, ParseError>;
#[derive(Debug)]
#[allow(clippy::upper_case_acronyms)]
pub enum ParseError {
IOError(IOError),
IncorrectFileHeader,
+1
View File
@@ -659,6 +659,7 @@ macro_rules! parse {
/// The mode of a beatmap.
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
#[allow(clippy::upper_case_acronyms)]
pub enum GameMode {
STD = 0,
TKO = 1,
+1
View File
@@ -13,6 +13,7 @@ use crate::OsuPP;
use crate::TaikoPP;
/// Calculator for pp on maps of any mode.
#[allow(clippy::upper_case_acronyms)]
pub enum AnyPP<'m> {
#[cfg(feature = "fruits")]
Fruits(FruitsPP<'m>),
+1
View File
@@ -29,6 +29,7 @@ use crate::{Beatmap, Mods, PpResult, StarResult};
/// println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());
/// ```
#[derive(Clone, Debug)]
#[allow(clippy::upper_case_acronyms)]
pub struct TaikoPP<'m> {
map: &'m Beatmap,
stars: Option<f32>,