pub enum BeatmapAttribute {
None,
Value(f32),
Given(f32),
Fixed(f32),
}Expand description
A beatmap attribute.
It contains either:
- the default value (5.0)
- a value taken from a
Beatmapor mutated default value - a user-given value that may be adjusted
- a user-given fixed value that will stay as-is
Variants§
None
No value has been set.
Will be treated as the default value (5.0).
Value(f32)
Variable value taken from a Beatmap or mutated default value that
may be overriden and adjusted based on mods and clock rate.
Given(f32)
Given by the user and may not be overriden by custom mod values.
Mods and clock rate may adjust the value, though.
§Example
Mods include DifficultyAdjust which sets AR to 9.5 but the user
specified AR to be 9.7. In this case, the user’s value is should take
precedence.
Fixed(f32)
Represents a final value that should not be adjusted based on mods or clock rate.
Implementations§
Source§impl BeatmapAttribute
impl BeatmapAttribute
Sourcepub const fn overwrite(self, other: Self) -> Self
pub const fn overwrite(self, other: Self) -> Self
Overwrites self with other if other is not None.
Sourcepub fn try_mutate(&mut self, f: impl Fn(&mut f32))
pub fn try_mutate(&mut self, f: impl Fn(&mut f32))
Mutates the Value and Given variants.
Sourcepub fn map_or_else<U, D, F>(self, default: D, f: F) -> U
pub fn map_or_else<U, D, F>(self, default: D, f: F) -> U
Applies f onto the Value and Given variants and default onto the
Fixed variant.
pub const fn get_raw(self) -> f32
Trait Implementations§
Source§impl Clone for BeatmapAttribute
impl Clone for BeatmapAttribute
Source§fn clone(&self) -> BeatmapAttribute
fn clone(&self) -> BeatmapAttribute
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BeatmapAttribute
impl Debug for BeatmapAttribute
Source§impl Default for BeatmapAttribute
impl Default for BeatmapAttribute
Source§fn default() -> BeatmapAttribute
fn default() -> BeatmapAttribute
Returns the “default value” for a type. Read more
Source§impl PartialEq for BeatmapAttribute
impl PartialEq for BeatmapAttribute
impl Copy for BeatmapAttribute
impl StructuralPartialEq for BeatmapAttribute
Auto Trait Implementations§
impl Freeze for BeatmapAttribute
impl RefUnwindSafe for BeatmapAttribute
impl Send for BeatmapAttribute
impl Sync for BeatmapAttribute
impl Unpin for BeatmapAttribute
impl UnsafeUnpin for BeatmapAttribute
impl UnwindSafe for BeatmapAttribute
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more