Struct rosu_pp::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 const 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_in_place(&mut self, mode: GameMode) -> ConvertStatus

Convert a &mut Beatmap to the specified mode with an argument instead of a generic parameter.

source

pub fn try_as_converted<M: IGameMode>(&self) -> Option<Converted<'_, M>>

Attempt to convert a &Beatmap to the specified mode.

If the conversion is incompatible, None is returned.

source

pub fn unchecked_as_converted<M: IGameMode>(&self) -> Converted<'_, M>

Convert a &Beatmap to the specified mode.

§Panics

Panics if the conversion is incompatible.

source

pub fn try_as_converted_mut<M: IGameMode>(&mut self) -> Option<Converted<'_, M>>

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

If the conversion is incompatible, None is returned.

source

pub fn unchecked_as_converted_mut<M: IGameMode>(&mut self) -> Converted<'_, M>

Convert a &mut Beatmap to the specified mode.

§Panics

Panics if the conversion is incompatible.

source

pub fn try_into_converted<'a, M: IGameMode>( self ) -> Result<Converted<'a, M>, Self>

Attempt to convert a Beatmap to the specified mode.

If the conversion is incompatible the Beatmap will be returned unchanged as Err.

source

pub fn unchecked_into_converted<'a, M: IGameMode>(self) -> Converted<'a, M>

Convert a Beatmap to the specified mode.

§Panics

Panics if the conversion is incompatible.

Trait Implementations§

source§

impl Clone for Beatmap

source§

fn clone(&self) -> Beatmap

Returns a copy 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

§

type Error = ParseBeatmapError

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

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.

§

type Err = Error

The associated error which can be returned from parsing.
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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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> 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,

§

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>,

§

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>,

§

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.