Struct rosu_pp::OsuPP[][src]

pub struct OsuPP<'m> { /* fields omitted */ }

Calculator for pp on osu!standard maps.

Example

let map: Beatmap = ...
let pp_result: PpResult = OsuPP::new(&map)
    .mods(8 + 64) // HDDT
    .combo(1234)
    .misses(1)
    .accuracy(98.5) // should be set last
    .calculate();

println!("PP: {} | Stars: {}", pp_result.pp(), pp_result.stars());

let next_result = OsuPP::new(&map)
    .attributes(pp_result)  // reusing previous results for performance
    .mods(8 + 64)           // has to be the same to reuse attributes
    .accuracy(99.5)
    .calculate();

println!("PP: {} | Stars: {}", next_result.pp(), next_result.stars());

Implementations

impl<'m> OsuPP<'m>[src]

pub fn new(map: &'m Beatmap) -> Self[src]

pub fn attributes(self, attributes: impl OsuAttributeProvider) -> Self[src]

OsuAttributeProvider is implemented by DifficultyAttributes and by PpResult meaning you can give the result of a star calculation or a pp calculation. If you already calculated the attributes for the current map-mod combination, be sure to put them in here so that they don’t have to be recalculated.

pub fn mods(self, mods: u32) -> Self[src]

Specify mods through their bit values.

See https://github.com/ppy/osu-api/wiki#mods

pub fn combo(self, combo: usize) -> Self[src]

Specify the max combo of the play.

pub fn n300(self, n300: usize) -> Self[src]

Specify the amount of 300s of a play.

pub fn n100(self, n100: usize) -> Self[src]

Specify the amount of 100s of a play.

pub fn n50(self, n50: usize) -> Self[src]

Specify the amount of 50s of a play.

pub fn misses(self, n_misses: usize) -> Self[src]

Specify the amount of misses of a play.

pub fn passed_objects(self, passed_objects: usize) -> Self[src]

Amount of passed objects for partial plays, e.g. a fail.

pub fn accuracy(self, acc: f32) -> Self[src]

Generate the hit results with respect to the given accuracy between 0 and 100.

Be sure to set misses beforehand! In case of a partial play, be also sure to set passed_objects beforehand!

pub fn calculate(self) -> PpResult[src]

Returns an object which contains the pp and DifficultyAttributes containing stars and other attributes.

Trait Implementations

impl<'m> Clone for OsuPP<'m>[src]

impl<'m> Debug for OsuPP<'m>[src]

Auto Trait Implementations

impl<'m> RefUnwindSafe for OsuPP<'m>

impl<'m> Send for OsuPP<'m>

impl<'m> Sync for OsuPP<'m>

impl<'m> Unpin for OsuPP<'m>

impl<'m> UnwindSafe for OsuPP<'m>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.