Struct Beatmap

Source
pub struct Beatmap {
Show 16 fields pub version: i32, pub is_convert: bool, pub stack_leniency: f32, pub mode: GameMode, pub ar: f32, pub cs: f32, pub hp: f32, pub od: f32, pub slider_multiplier: f64, pub slider_tick_rate: f64, pub breaks: Vec<BreakPeriod>, pub timing_points: Vec<TimingPoint>, pub difficulty_points: Vec<DifficultyPoint>, pub effect_points: Vec<EffectPoint>, pub hit_objects: Vec<HitObject>, pub hit_sounds: Vec<HitSoundType>,
}
Expand description

All beatmap data that is relevant for difficulty and performance calculation.

Fields§

§version: i32§is_convert: bool§stack_leniency: f32§mode: GameMode§ar: f32§cs: f32§hp: f32§od: f32§slider_multiplier: f64§slider_tick_rate: f64§breaks: Vec<BreakPeriod>§timing_points: Vec<TimingPoint>§difficulty_points: Vec<DifficultyPoint>§effect_points: Vec<EffectPoint>§hit_objects: Vec<HitObject>§hit_sounds: Vec<HitSoundType>

Implementations§

Source§

impl Beatmap

Source

pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, Error>

Parse a Beatmap by providing a path to a .osu file.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>

Parse a Beatmap by providing the content of a .osu file as a slice of bytes.

Source

pub fn attributes(&self) -> BeatmapAttributesBuilder

Returns a BeatmapAttributesBuilder to calculate modified beatmap attributes.

Source

pub fn bpm(&self) -> f64

The beats per minute of the map.

Source

pub fn performance(&self) -> Performance<'_>

Create a performance calculator for this Beatmap.

Source

pub fn gradual_difficulty(&self, difficulty: Difficulty) -> GradualDifficulty

Create a gradual difficulty calculator for this Beatmap.

Source

pub fn gradual_performance(&self, difficulty: Difficulty) -> GradualPerformance

Create a gradual performance calculator for this Beatmap.

Source

pub fn total_break_time(&self) -> f64

Sum up the duration of all breaks (in milliseconds).

Source

pub fn convert( self, mode: GameMode, mods: &GameMods, ) -> Result<Self, ConvertError>

Attempt to convert a Beatmap to the specified mode.

Source

pub fn convert_ref( &self, mode: GameMode, mods: &GameMods, ) -> Result<Cow<'_, Self>, ConvertError>

Attempt to convert a &Beatmap to the specified mode.

Source

pub fn convert_mut( &mut self, mode: GameMode, mods: &GameMods, ) -> Result<(), ConvertError>

Attempt to convert a &mut Beatmap to the specified mode.

Source

pub fn check_suspicion(&self) -> Result<(), TooSuspicious>

Check whether hitobjects appear too suspicious for further calculation.

Sometimes a Beatmap isn’t created for gameplay but rather to test the limits of osu! itself. Difficulty- and/or performance calculation should likely be avoided on these maps due to potential performance issues.

Trait Implementations§

Source§

impl Clone for Beatmap

Source§

fn clone(&self) -> Beatmap

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 Beatmap

Source§

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

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

impl DecodeBeatmap for Beatmap

Source§

type Error = ParseBeatmapError

Error type in case something goes wrong while parsing. Read more
Source§

type State = BeatmapState

The parsing state which will be updated on each line and turned into Self at the end.
Source§

fn parse_general(state: &mut Self::State, line: &str) -> Result<(), Self::Error>

Update the state based on a line of the [General] section.
Source§

fn parse_editor(_: &mut Self::State, _: &str) -> Result<(), Self::Error>

Update the state based on a line of the [Editor] section.
Source§

fn parse_metadata(_: &mut Self::State, _: &str) -> Result<(), Self::Error>

Update the state based on a line of the [Metadata] section.
Source§

fn parse_difficulty( state: &mut Self::State, line: &str, ) -> Result<(), Self::Error>

Update the state based on a line of the [Difficulty] section.
Source§

fn parse_events(state: &mut Self::State, line: &str) -> Result<(), Self::Error>

Update the state based on a line of the [Events] section.
Source§

fn parse_timing_points( state: &mut Self::State, line: &str, ) -> Result<(), Self::Error>

Update the state based on a line of the [TimingPoints] section.
Source§

fn parse_colors(_: &mut Self::State, _: &str) -> Result<(), Self::Error>

Update the state based on a line of the [Colours] section.
Source§

fn parse_hit_objects( state: &mut Self::State, line: &str, ) -> Result<(), Self::Error>

Update the state based on a line of the [HitObjects] section.
Source§

fn parse_variables(_: &mut Self::State, _: &str) -> Result<(), Self::Error>

Update the state based on a line of the [Variables] section.
Source§

fn parse_catch_the_beat(_: &mut Self::State, _: &str) -> Result<(), Self::Error>

Update the state based on a line of the [CatchTheBeat] section.
Source§

fn parse_mania(_: &mut Self::State, _: &str) -> Result<(), Self::Error>

Update the state based on a line of the [Mania] section.
Source§

fn decode<R>(src: R) -> Result<Self, Error>
where R: BufRead,

The key method to read and parse content of a .osu file into Self. Read more
Source§

fn should_skip_line(line: &str) -> bool

Whether a line should not be forwarded to the parsing methods.
Source§

impl Default for Beatmap

Source§

fn default() -> Self

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

impl From<&Beatmap> for BeatmapAttributesBuilder

Source§

fn from(map: &Beatmap) -> Self

Converts to this type from the input type.
Source§

impl From<BeatmapState> for Beatmap

Source§

fn from(state: BeatmapState) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Beatmap

Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parse a Beatmap by providing the content of a .osu file as a string.

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl<'a> IntoModePerformance<'a, Catch> for Beatmap

Source§

impl<'a> IntoModePerformance<'a, Mania> for Beatmap

Source§

impl<'a> IntoModePerformance<'a, Osu> for Beatmap

Source§

impl<'a> IntoModePerformance<'a, Taiko> for Beatmap

Source§

impl<'map> IntoModePerformance<'map, Catch> for &'map Beatmap

Source§

impl<'map> IntoModePerformance<'map, Mania> for &'map Beatmap

Source§

impl<'map> IntoModePerformance<'map, Osu> for &'map Beatmap

Source§

impl<'map> IntoModePerformance<'map, Taiko> for &'map Beatmap

Source§

impl<'a> IntoPerformance<'a> for Beatmap

Source§

impl<'map> IntoPerformance<'map> for &'map Beatmap

Source§

impl PartialEq for Beatmap

Source§

fn eq(&self, other: &Beatmap) -> 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 StructuralPartialEq for Beatmap

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.