perf: implement GradualDifficulty::nth manually

This commit is contained in:
MaxOhn
2023-11-08 22:20:05 +01:00
parent a9a7cd507e
commit 8a643fb6f0
+10
View File
@@ -85,6 +85,16 @@ impl Iterator for GradualDifficulty<'_> {
GradualDifficulty::Mania(m) => m.size_hint(),
}
}
#[inline]
fn nth(&mut self, n: usize) -> Option<Self::Item> {
match self {
Self::Osu(o) => o.nth(n).map(DifficultyAttributes::Osu),
Self::Taiko(t) => t.nth(n).map(DifficultyAttributes::Taiko),
Self::Catch(c) => c.nth(n).map(DifficultyAttributes::Catch),
Self::Mania(m) => m.nth(n).map(DifficultyAttributes::Mania),
}
}
}
/// Gradually calculate the performance attributes on maps of any mode.