simplified feature cfg's

This commit is contained in:
MaxOhn
2021-11-21 03:31:51 +01:00
parent 79bc7441e8
commit c6b0fc55a8
3 changed files with 16 additions and 15 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
#![cfg(any(feature = "osu", feature = "fruits"))]
#![cfg(feature = "sliders")]
use crate::{
parse::{DifficultyPoint, TimingPoint},
@@ -42,7 +42,7 @@ pub(crate) enum ControlPoint {
Difficulty { time: f64, slider_velocity: f64 },
}
#[cfg(any(feature = "osu", feature = "fruits"))]
#[cfg(feature = "sliders")]
impl ControlPoint {
#[inline]
pub(crate) fn time(&self) -> f64 {
+2 -2
View File
@@ -126,10 +126,10 @@ pub use pp::{AnyPP, AttributeProvider};
mod curve;
mod mods;
#[cfg(any(feature = "osu", feature = "fruits"))]
#[cfg(feature = "sliders")]
pub(crate) mod control_point_iter;
#[cfg(any(feature = "osu", feature = "fruits"))]
#[cfg(feature = "sliders")]
pub(crate) use control_point_iter::{ControlPoint, ControlPointIter};
#[cfg(feature = "fruits")]
+12 -11
View File
@@ -408,12 +408,12 @@ macro_rules! parse_timingpoints {
buf: &mut String,
section: &mut Section,
) -> ParseResult<bool> {
#[cfg(not(any(feature = "osu", feature = "fruits")))]
#[cfg(not(feature = "sliders"))]
{
parse_timingpoints_body!(short => self, reader, buf, section)
}
#[cfg(any(feature = "osu", feature = "fruits"))]
#[cfg(feature = "sliders")]
parse_timingpoints_body!(self, reader, buf, section)
}
};
@@ -425,12 +425,12 @@ macro_rules! parse_timingpoints {
buf: &mut String,
section: &mut Section,
) -> ParseResult<bool> {
#[cfg(not(any(feature = "osu", feature = "fruits")))]
#[cfg(not(feature = "sliders"))]
{
parse_timingpoints_body!(short => self, reader, buf, section)
}
#[cfg(any(feature = "osu", feature = "fruits"))]
#[cfg(feature = "sliders")]
parse_timingpoints_body!(self, reader, buf, section)
}
};
@@ -814,14 +814,15 @@ pub struct Beatmap {
/// All hitobjects of the beatmap.
pub hit_objects: Vec<HitObject>,
#[cfg(not(any(feature = "osu", feature = "fruits")))]
bpm: f64,
#[cfg(not(feature = "sliders"))]
/// Beats per minute
pub bpm: f64,
#[cfg(any(feature = "osu", feature = "fruits"))]
#[cfg(feature = "sliders")]
/// Timing points that indicate a new timing section.
pub timing_points: Vec<TimingPoint>,
#[cfg(any(feature = "osu", feature = "fruits"))]
#[cfg(feature = "sliders")]
/// Timing point for the current timing section.
pub difficulty_points: Vec<DifficultyPoint>,
@@ -848,7 +849,7 @@ impl Beatmap {
}
/// The beats per minute of the map.
#[cfg(any(feature = "osu", feature = "fruits"))]
#[cfg(feature = "sliders")]
#[inline]
pub fn bpm(&self) -> f64 {
match self.timing_points.first() {
@@ -858,7 +859,7 @@ impl Beatmap {
}
/// The beats per minute of the map.
#[cfg(not(any(feature = "osu", feature = "fruits")))]
#[cfg(not(feature = "sliders"))]
#[inline]
pub fn bpm(&self) -> f64 {
self.bpm
@@ -1184,7 +1185,7 @@ mod tests {
println!("tick_rate: {}", map.tick_rate);
println!("hit_objects: {}", map.hit_objects.len());
#[cfg(any(feature = "osu", feature = "fruits"))]
#[cfg(feature = "sliders")]
{
#[cfg(feature = "osu")]
println!("stack_leniency: {}", map.stack_leniency);