Skip to main content

BeatmapAttribute

Enum BeatmapAttribute 

Source
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 Beatmap or 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

Source

pub const DEFAULT: f32 = 5.0

The default value for a BeatmapAttribute.

Source

pub const fn overwrite(self, other: Self) -> Self

Overwrites self with other if other is not None.

Source

pub fn try_mutate(&mut self, f: impl Fn(&mut f32))

Mutates the Value and Given variants.

Source

pub const fn try_set(&mut self, value: f32)

Sets the Value variant only.

Source

pub fn map_or_else<U, D, F>(self, default: D, f: F) -> U
where D: FnOnce(f32) -> U, F: FnOnce(f32) -> U,

Applies f onto the Value and Given variants and default onto the Fixed variant.

Source

pub const fn get_raw(self) -> f32

Trait Implementations§

Source§

impl Clone for BeatmapAttribute

Source§

fn clone(&self) -> BeatmapAttribute

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BeatmapAttribute

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BeatmapAttribute

Source§

fn default() -> BeatmapAttribute

Returns the “default value” for a type. Read more
Source§

impl PartialEq for BeatmapAttribute

Source§

fn eq(&self, other: &BeatmapAttribute) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for BeatmapAttribute

Source§

impl StructuralPartialEq for BeatmapAttribute

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.