feat: make From impl for AnyPP generic
This commit is contained in:
@@ -67,7 +67,7 @@ impl<'map> AnyPP<'map> {
|
|||||||
/// as when the attributes were calculated.
|
/// as when the attributes were calculated.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn from_attributes(attributes: impl AttributeProvider) -> Self {
|
pub fn from_attributes(attributes: impl AttributeProvider) -> Self {
|
||||||
Self::from(attributes.attributes())
|
Self::from(attributes)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Consume the performance calculator and calculate
|
/// Consume the performance calculator and calculate
|
||||||
@@ -296,22 +296,19 @@ impl<'map> AnyPP<'map> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<DifficultyAttributes> for AnyPP<'_> {
|
impl<A: AttributeProvider> From<A> for AnyPP<'_> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(attrs: DifficultyAttributes) -> Self {
|
fn from(attrs: A) -> Self {
|
||||||
match attrs {
|
fn inner(attrs: DifficultyAttributes) -> AnyPP<'static> {
|
||||||
DifficultyAttributes::Osu(attrs) => Self::Osu(attrs.pp()),
|
match attrs {
|
||||||
DifficultyAttributes::Taiko(attrs) => Self::Taiko(attrs.pp()),
|
DifficultyAttributes::Osu(attrs) => AnyPP::Osu(attrs.pp()),
|
||||||
DifficultyAttributes::Catch(attrs) => Self::Catch(attrs.pp()),
|
DifficultyAttributes::Taiko(attrs) => AnyPP::Taiko(attrs.pp()),
|
||||||
DifficultyAttributes::Mania(attrs) => Self::Mania(attrs.pp()),
|
DifficultyAttributes::Catch(attrs) => AnyPP::Catch(attrs.pp()),
|
||||||
|
DifficultyAttributes::Mania(attrs) => AnyPP::Mania(attrs.pp()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<PerformanceAttributes> for AnyPP<'_> {
|
inner(attrs.attributes())
|
||||||
#[inline]
|
|
||||||
fn from(attrs: PerformanceAttributes) -> Self {
|
|
||||||
attrs.difficulty_attributes().into()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user