adjust doc examples
This commit is contained in:
@@ -35,7 +35,7 @@ use crate::{
|
||||
///
|
||||
/// let map = Beatmap::from_path("./resources/2785319.osu").unwrap();
|
||||
/// let difficulty = ModeDifficulty::new().mods(64); // DT
|
||||
/// let mut gradual_perf = GradualPerformance::new(&difficulty, &map);
|
||||
/// let mut gradual = GradualPerformance::new(&difficulty, &map);
|
||||
/// let mut state = ScoreState::new(); // empty state, everything is on 0.
|
||||
///
|
||||
/// // The first 10 hitresults are 300s
|
||||
@@ -43,8 +43,8 @@ use crate::{
|
||||
/// state.n300 += 1;
|
||||
/// state.max_combo += 1;
|
||||
///
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp());
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp());
|
||||
/// }
|
||||
///
|
||||
/// // Then comes a miss.
|
||||
@@ -52,8 +52,8 @@ use crate::{
|
||||
/// // the next few objects because the combo is reset.
|
||||
/// state.misses += 1;
|
||||
///
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp());
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp());
|
||||
///
|
||||
/// // The next 10 objects will be a mixture of 300s, 100s, and 50s.
|
||||
/// // Notice how all 10 objects will be processed in one go.
|
||||
@@ -62,15 +62,15 @@ use crate::{
|
||||
/// state.n50 += 1;
|
||||
///
|
||||
/// // The `nth` method takes a zero-based value.
|
||||
/// let performance = gradual_perf.nth(state.clone(), 9).unwrap();
|
||||
/// println!("PP: {}", performance.pp());
|
||||
/// let attrs = gradual.nth(state.clone(), 9).unwrap();
|
||||
/// println!("PP: {}", attrs.pp());
|
||||
///
|
||||
/// // Now comes another 300. Note that the max combo gets incremented again.
|
||||
/// state.n300 += 1;
|
||||
/// state.max_combo += 1;
|
||||
///
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp());
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp());
|
||||
///
|
||||
/// // Skip to the end
|
||||
/// # /*
|
||||
@@ -78,12 +78,12 @@ use crate::{
|
||||
/// state.n300 = ...
|
||||
/// ...
|
||||
/// # */
|
||||
/// let final_performance = gradual_perf.last(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp());
|
||||
/// let attrs = gradual.last(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp());
|
||||
///
|
||||
/// // Once the final performance has been calculated, attempting to process
|
||||
/// // further objects will return `None`.
|
||||
/// assert!(gradual_perf.next(state).is_none());
|
||||
/// assert!(gradual.next(state).is_none());
|
||||
/// ```
|
||||
///
|
||||
/// [`next`]: GradualPerformance::next
|
||||
|
||||
@@ -29,7 +29,7 @@ use crate::{
|
||||
/// .unchecked_into_converted::<Catch>();
|
||||
///
|
||||
/// let difficulty = ModeDifficulty::new().mods(64); // DT
|
||||
/// let mut gradual_perf = CatchGradualPerformance::new(&difficulty, &converted);
|
||||
/// let mut gradual = CatchGradualPerformance::new(&difficulty, &converted);
|
||||
/// let mut state = CatchScoreState::new(); // empty state, everything is on 0.
|
||||
///
|
||||
/// // The first 10 hitresults are only fruits
|
||||
@@ -37,16 +37,16 @@ use crate::{
|
||||
/// state.n_fruits += 1;
|
||||
/// state.max_combo += 1;
|
||||
///
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
/// }
|
||||
///
|
||||
/// // Then comes a miss.
|
||||
/// // Note that state's max combo won't be incremented for
|
||||
/// // the next few objects because the combo is reset.
|
||||
/// state.misses += 1;
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // The next 10 objects will be a mixture of fruits and droplets.
|
||||
/// // Notice how tiny droplets from sliders do not count as hit objects
|
||||
@@ -56,14 +56,14 @@ use crate::{
|
||||
/// state.n_droplets += 6;
|
||||
/// state.n_tiny_droplets += 12;
|
||||
/// // The `nth` method takes a zero-based value.
|
||||
/// let performance = gradual_perf.nth(state.clone(), 9).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.nth(state.clone(), 9).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // Now comes another fruit. Note that the max combo gets incremented again.
|
||||
/// state.n_fruits += 1;
|
||||
/// state.max_combo += 1;
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // Skip to the end
|
||||
/// # /*
|
||||
@@ -74,12 +74,12 @@ use crate::{
|
||||
/// state.n_tiny_droplet_misses = ...
|
||||
/// state.misses = ...
|
||||
/// # */
|
||||
/// let final_performance = gradual_perf.last(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.last(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // Once the final performance has been calculated,
|
||||
/// // attempting to process further objects will return `None`.
|
||||
/// assert!(gradual_perf.next(state).is_none());
|
||||
/// // Once the final performance has been calculated, attempting to process
|
||||
/// // further objects will return `None`.
|
||||
/// assert!(gradual.next(state).is_none());
|
||||
/// ```
|
||||
///
|
||||
/// [`next`]: CatchGradualPerformance::next
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@
|
||||
//! score state.
|
||||
//!
|
||||
//! ```
|
||||
//! use rosu_pp::{Beatmap, GradualPerformance, ModeDifficulty};
|
||||
//! use rosu_pp::{Beatmap, GradualPerformance, ModeDifficulty, any::ScoreState};
|
||||
//!
|
||||
//! let map = Beatmap::from_path("./resources/1028484.osu").unwrap();
|
||||
//! let difficulty = ModeDifficulty::new().mods(16 + 64).clock_rate(1.2); // HRDT on 1.2x
|
||||
|
||||
@@ -28,29 +28,29 @@ use super::{ManiaPerformanceAttributes, ManiaScoreState};
|
||||
/// .unchecked_into_converted::<Mania>();
|
||||
///
|
||||
/// let difficulty = ModeDifficulty::new().mods(64); // DT
|
||||
/// let mut gradual_perf = ManiaGradualPerformance::new(&difficulty, &converted);
|
||||
/// let mut gradual = ManiaGradualPerformance::new(&difficulty, &converted);
|
||||
/// let mut state = ManiaScoreState::new(); // empty state, everything is on 0.
|
||||
///
|
||||
/// // The first 10 hitresults are 320s
|
||||
/// for _ in 0..10 {
|
||||
/// state.n320 += 1;
|
||||
///
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
/// }
|
||||
///
|
||||
/// // Then comes a miss.
|
||||
/// state.misses += 1;
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // The next 10 objects will be a mixture of 320s and 100s.
|
||||
/// // Notice how all 10 objects will be processed in one go.
|
||||
/// state.n320 += 3;
|
||||
/// state.n100 += 7;
|
||||
/// // The `nth` method takes a zero-based value.
|
||||
/// let performance = gradual_perf.nth(state.clone(), 9).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.nth(state.clone(), 9).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // Skip to the end
|
||||
/// # /*
|
||||
@@ -59,12 +59,12 @@ use super::{ManiaPerformanceAttributes, ManiaScoreState};
|
||||
/// state.n100 = ...
|
||||
/// state.misses = ...
|
||||
/// # */
|
||||
/// let final_performance = gradual_perf.nth(state.clone(), usize::MAX).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.last(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // Once the final performance was calculated,
|
||||
/// // attempting to process further objects will return `None`.
|
||||
/// assert!(gradual_perf.next(state).is_none());
|
||||
/// assert!(gradual.next(state).is_none());
|
||||
/// ```
|
||||
///
|
||||
/// [`next`]: ManiaGradualPerformance::next
|
||||
|
||||
@@ -28,7 +28,7 @@ use super::{OsuPerformanceAttributes, OsuScoreState};
|
||||
/// .unchecked_into_converted::<Osu>();
|
||||
///
|
||||
/// let difficulty = ModeDifficulty::new().mods(64); // DT
|
||||
/// let mut gradual_perf = OsuGradualPerformance::new(&difficulty, &converted);
|
||||
/// let mut gradual = OsuGradualPerformance::new(&difficulty, &converted);
|
||||
/// let mut state = OsuScoreState::new(); // empty state, everything is on 0.
|
||||
///
|
||||
/// // The first 10 hits are 300s and there are no sliders for additional combo
|
||||
@@ -36,15 +36,15 @@ use super::{OsuPerformanceAttributes, OsuScoreState};
|
||||
/// state.n300 += 1;
|
||||
/// state.max_combo += 1;
|
||||
///
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
/// }
|
||||
///
|
||||
/// // Then comes a miss. Note that state's max combo won't be incremented for
|
||||
/// // the next few objects because the combo is reset.
|
||||
/// state.misses += 1;
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // The next 10 objects will be a mixture of 300s, 100s, and 50s.
|
||||
/// // Notice how all 10 objects will be processed in one go.
|
||||
@@ -52,14 +52,14 @@ use super::{OsuPerformanceAttributes, OsuScoreState};
|
||||
/// state.n100 += 7;
|
||||
/// state.n50 += 1;
|
||||
/// // The `nth` method takes a zero-based value.
|
||||
/// let performance = gradual_perf.nth(state.clone(), 9).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.nth(state.clone(), 9).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // Now comes another 300. Note that the max combo gets incremented again.
|
||||
/// state.n300 += 1;
|
||||
/// state.max_combo += 1;
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // Skip to the end
|
||||
/// # /*
|
||||
@@ -69,12 +69,12 @@ use super::{OsuPerformanceAttributes, OsuScoreState};
|
||||
/// state.n50 = ...
|
||||
/// state.misses = ...
|
||||
/// # */
|
||||
/// let final_performance = gradual_perf.nth(state.clone(), usize::MAX).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.last(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // Once the final performance has been calculated, attempting to process
|
||||
/// // further objects will return `None`.
|
||||
/// assert!(gradual_perf.next(state).is_none());
|
||||
/// assert!(gradual.next(state).is_none());
|
||||
/// ```
|
||||
///
|
||||
/// [`next`]: OsuGradualPerformance::next
|
||||
|
||||
@@ -28,7 +28,7 @@ use super::TaikoPerformanceAttributes;
|
||||
/// .unchecked_into_converted::<Taiko>();
|
||||
///
|
||||
/// let difficulty = ModeDifficulty::new().mods(64); // DT
|
||||
/// let mut gradual_perf = TaikoGradualPerformance::new(&difficulty, &converted);
|
||||
/// let mut gradual = TaikoGradualPerformance::new(&difficulty, &converted);
|
||||
/// let mut state = TaikoScoreState::new(); // empty state, everything is on 0.
|
||||
///
|
||||
/// // The first 10 hitresults are 300s
|
||||
@@ -36,30 +36,30 @@ use super::TaikoPerformanceAttributes;
|
||||
/// state.n300 += 1;
|
||||
/// state.max_combo += 1;
|
||||
///
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
/// }
|
||||
///
|
||||
/// // Then comes a miss.
|
||||
/// // Note that state's max combo won't be incremented for
|
||||
/// // the next few objects because the combo is reset.
|
||||
/// state.misses += 1;
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // The next 10 objects will be a mixture of 300s and 100s.
|
||||
/// // Notice how all 10 objects will be processed in one go.
|
||||
/// state.n300 += 3;
|
||||
/// state.n100 += 7;
|
||||
/// // The `nth` method takes a zero-based value.
|
||||
/// let performance = gradual_perf.nth(state.clone(), 9).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.nth(state.clone(), 9).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // Now comes another 300. Note that the max combo gets incremented again.
|
||||
/// state.n300 += 1;
|
||||
/// state.max_combo += 1;
|
||||
/// let performance = gradual_perf.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.next(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // Skip to the end
|
||||
/// # /*
|
||||
@@ -68,12 +68,12 @@ use super::TaikoPerformanceAttributes;
|
||||
/// state.n100 = ...
|
||||
/// state.misses = ...
|
||||
/// # */
|
||||
/// let final_performance = gradual_perf.nth(state.clone(), usize::MAX).unwrap();
|
||||
/// println!("PP: {}", performance.pp);
|
||||
/// let attrs = gradual.last(state.clone()).unwrap();
|
||||
/// println!("PP: {}", attrs.pp);
|
||||
///
|
||||
/// // Once the final performance was calculated,
|
||||
/// // attempting to process further objects will return `None`.
|
||||
/// assert!(gradual_perf.next(state).is_none());
|
||||
/// // Once the final performance has been calculated, attempting to process
|
||||
/// // further objects will return `None`.
|
||||
/// assert!(gradual.next(state).is_none());
|
||||
/// ```
|
||||
///
|
||||
/// [`next`]: TaikoGradualPerformance::next
|
||||
|
||||
Reference in New Issue
Block a user