Struct peace_performance::OsuPP[][src]

pub struct OsuPP<'m> {
    pub map: &'m Beatmap,
    pub attributes: Option<DifficultyAttributes>,
    pub mods: u32,
    pub combo: Option<usize>,
    pub acc: Option<f32>,
    pub n300: Option<usize>,
    pub n100: Option<usize>,
    pub n50: Option<usize>,
    pub n_misses: usize,
    pub passed_objects: Option<usize>,
}
Expand description

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());

Fields

map: &'m Beatmapattributes: Option<DifficultyAttributes>mods: u32combo: Option<usize>acc: Option<f32>n300: Option<usize>n100: Option<usize>n50: Option<usize>n_misses: usizepassed_objects: Option<usize>

Implementations

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.

Specify mods through their bit values.

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

Specify the max combo of the play.

Specify the amount of 300s of a play.

Specify the amount of 100s of a play.

Specify the amount of 50s of a play.

Specify the amount of misses of a play.

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

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!

Set acc value

If it is used to calculate the PP of multiple different ACCs, it should be called from high to low according to the ACC value, otherwise it is invalid.

Examples:

// valid
let acc_100 = {
    c.set_accuracy(100.0);
    c.calculate().await
};
let acc_99 = {
    c.set_accuracy(99.0);
    c.calculate().await
};
let acc_98 = {
    c.set_accuracy(98.0);
    c.calculate().await
};
let acc_95 = {
    c.set_accuracy(95.0);
    c.calculate().await
};

// invalid
let acc_95 = {
    c.set_accuracy(95.0);
    c.calculate().await
};
let acc_98 = {
    c.set_accuracy(98.0);
    c.calculate().await
};
let acc_99 = {
    c.set_accuracy(99.0);
    c.calculate().await
};
let acc_100 = {
    c.set_accuracy(100.0);
    c.calculate().await
};

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.