added examples
This commit is contained in:
@@ -10,6 +10,24 @@ use crate::{
|
||||
};
|
||||
|
||||
/// Difficulty calculator on maps of a given mode.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use rosu_pp::{Beatmap, ConvertedDifficulty};
|
||||
/// use rosu_pp::catch::{Catch, CatchDifficultyAttributes};
|
||||
///
|
||||
/// let converted = Beatmap::from_path("./resources/2118524.osu")
|
||||
/// .unwrap()
|
||||
/// .unchecked_into_converted();
|
||||
///
|
||||
/// let difficulty = ConvertedDifficulty::<Catch>::new();
|
||||
/// // Same as `Difficulty::new().with_mode::<Catch>();`
|
||||
///
|
||||
/// let attrs: CatchDifficultyAttributes = difficulty
|
||||
/// .mods(8 + 1024) // HDFL
|
||||
/// .calculate(&converted);
|
||||
/// ```
|
||||
#[must_use]
|
||||
pub struct ConvertedDifficulty<M> {
|
||||
inner: Difficulty,
|
||||
|
||||
@@ -23,6 +23,18 @@ pub mod skills;
|
||||
use crate::{model::mode::IGameMode, util::mods::Mods};
|
||||
|
||||
/// Difficulty calculator on maps of any mode.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use rosu_pp::{Beatmap, Difficulty, any::DifficultyAttributes};
|
||||
///
|
||||
/// let map = Beatmap::from_path("./resources/2118524.osu").unwrap();
|
||||
///
|
||||
/// let attrs: DifficultyAttributes = Difficulty::new()
|
||||
/// .mods(8 + 1024) // HDFL
|
||||
/// .calculate(&map);
|
||||
/// ```
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq)]
|
||||
#[must_use]
|
||||
pub struct Difficulty {
|
||||
|
||||
Reference in New Issue
Block a user