Struct rosu_pp::Converted

source ·
pub struct Converted<'a, M> { /* private fields */ }
Expand description

A Beatmap that is attached to a mode.

§Incompatibility

The following conversions are compatible:

  • OsuOsu
  • TaikoTaiko
  • CatchCatch
  • ManiaMania
  • OsuTaiko
  • OsuCatch
  • OsuMania

All other conversions are incompatible.

Implementations§

source§

impl<'a, M> Converted<'a, M>

source

pub fn into_inner(self) -> Cow<'a, Beatmap>

Returns the internal Beatmap.

source

pub fn as_owned(&'a self) -> Self

Borrow the contained Beatmap to cheaply create a new owned Converted.

This is the same as .clone() except cheap - but its lifetime might be shorter.

source§

impl<M: IGameMode> Converted<'_, M>

source

pub fn try_from_owned(map: Beatmap) -> Result<Self, Beatmap>

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_from_owned(map: Beatmap) -> Self

Convert a Beatmap to the specified mode.

§Panics

Panics if the conversion is incompatible.

source

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

Create a gradual difficulty calculator for the map.

source

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

Create a gradual performance calculator for the map.

source§

impl<'a, M: IGameMode> Converted<'a, M>

source

pub fn performance(self) -> M::Performance<'a>

Create a performance calculator for the map.

source

pub fn try_from_ref(map: &'a Beatmap) -> Option<Self>

Attempt to convert a &Beatmap to the specified mode.

If the conversion is incompatible, None is returned.

source

pub fn unchecked_from_ref(map: &'a Beatmap) -> Self

Convert a &Beatmap to the specified mode.

§Panics

Panics if the conversion is incompatible.

source

pub fn try_from_mut(map: &'a mut Beatmap) -> Option<Self>

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

If the conversion is incompatible, None is returned.

source

pub fn unchecked_from_mut(map: &'a mut Beatmap) -> Self

Convert a &mut Beatmap to the specified mode.

§Panics

Panics if the conversion is incompatible.

source

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

Attempt to convert a Converted from mode M to mode N.

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

source

pub fn unchecked_convert<N: IGameMode>(self) -> Converted<'a, N>

Convert a Converted from mode M to mode N.

§Panics

Panics if the conversion is incompatible.

Methods from Deref<Target = Beatmap>§

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

Trait Implementations§

source§

impl<M> Clone for Converted<'_, M>

source§

fn clone(&self) -> Self

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<M> Debug for Converted<'_, M>

source§

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

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

impl<M> Deref for Converted<'_, M>

§

type Target = Beatmap

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<M> From<&Converted<'_, M>> for BeatmapAttributesBuilder

source§

fn from(converted: &Converted<'_, M>) -> Self

Converts to this type from the input type.
source§

impl<'map> IntoModePerformance<'map, Catch> for &'map Converted<'_, Catch>

source§

impl<'map> IntoModePerformance<'map, Catch> for Converted<'map, Catch>

source§

impl<'map> IntoModePerformance<'map, Mania> for &'map Converted<'_, Mania>

source§

impl<'map> IntoModePerformance<'map, Mania> for Converted<'map, Mania>

source§

impl<'map> IntoModePerformance<'map, Osu> for &'map Converted<'_, Osu>

source§

impl<'map> IntoModePerformance<'map, Osu> for Converted<'map, Osu>

source§

impl<'map> IntoModePerformance<'map, Taiko> for &'map Converted<'_, Taiko>

source§

impl<'map> IntoModePerformance<'map, Taiko> for Converted<'map, Taiko>

source§

impl<'map> IntoPerformance<'map> for &'map Converted<'_, Catch>

source§

impl<'map> IntoPerformance<'map> for &'map Converted<'_, Mania>

source§

impl<'map> IntoPerformance<'map> for &'map Converted<'_, Osu>

source§

impl<'map> IntoPerformance<'map> for &'map Converted<'_, Taiko>

source§

impl<'map> IntoPerformance<'map> for Converted<'map, Catch>

source§

impl<'map> IntoPerformance<'map> for Converted<'map, Mania>

source§

impl<'map> IntoPerformance<'map> for Converted<'map, Osu>

source§

impl<'map> IntoPerformance<'map> for Converted<'map, Taiko>

source§

impl<M> PartialEq for Converted<'_, M>

source§

fn eq(&self, other: &Self) -> 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.

Auto Trait Implementations§

§

impl<'a, M> Freeze for Converted<'a, M>

§

impl<'a, M> RefUnwindSafe for Converted<'a, M>
where M: RefUnwindSafe,

§

impl<'a, M> Send for Converted<'a, M>
where M: Send,

§

impl<'a, M> Sync for Converted<'a, M>
where M: Sync,

§

impl<'a, M> Unpin for Converted<'a, M>
where M: Unpin,

§

impl<'a, M> UnwindSafe for Converted<'a, M>
where M: UnwindSafe,

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.