added examples

This commit is contained in:
MaxOhn
2024-03-03 10:30:40 +01:00
parent 38e072a1dc
commit 5fb393a109
2 changed files with 30 additions and 0 deletions
+18
View File
@@ -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,
+12
View File
@@ -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 {