made bunch of functions const

This commit is contained in:
MaxOhn
2024-02-29 23:31:07 +01:00
parent 270d3d0008
commit 852f6cfa45
21 changed files with 233 additions and 140 deletions
+2 -2
View File
@@ -30,11 +30,11 @@ pub struct Difficulty<'map> {
impl<'map> Difficulty<'map> {
/// Create a new difficulty calculator for the given beatmap.
pub fn new(map: &'map Beatmap) -> Self {
pub const fn new(map: &'map Beatmap) -> Self {
Self::new_with_is_convert(Cow::Borrowed(map), false)
}
fn new_with_is_convert(map: Cow<'map, Beatmap>, is_convert: bool) -> Self {
const fn new_with_is_convert(map: Cow<'map, Beatmap>, is_convert: bool) -> Self {
Self {
map,
is_convert,
+6 -2
View File
@@ -14,8 +14,12 @@ pub struct ModeDifficulty {
impl ModeDifficulty {
/// Create a new difficulty calculator.
pub fn new() -> Self {
Self::default()
pub const fn new() -> Self {
Self {
mods: 0,
passed_objects: None,
clock_rate: None,
}
}
/// Specify mods through their bit values.