allow specifying map for map attrs builder later

This commit is contained in:
MaxOhn
2024-03-18 20:39:35 +01:00
parent f23e2bbeb9
commit 788a372abe
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -73,8 +73,8 @@ impl BeatmapAttributesBuilder {
} }
} }
/// Create a new [`BeatmapAttributesBuilder`] from a [`Beatmap`]. /// Use the given [`Beatmap`]'s attributes, mode, and convert status.
pub const fn from_map(map: &Beatmap) -> Self { pub const fn map(self, map: &Beatmap) -> Self {
Self { Self {
mode: map.mode, mode: map.mode,
ar: ModsDependent::new(map.ar), ar: ModsDependent::new(map.ar),
@@ -323,13 +323,13 @@ impl BeatmapAttributesBuilder {
impl From<&Beatmap> for BeatmapAttributesBuilder { impl From<&Beatmap> for BeatmapAttributesBuilder {
fn from(map: &Beatmap) -> Self { fn from(map: &Beatmap) -> Self {
Self::from_map(map) Self::new().map(map)
} }
} }
impl<M> From<&Converted<'_, M>> for BeatmapAttributesBuilder { impl<M> From<&Converted<'_, M>> for BeatmapAttributesBuilder {
fn from(converted: &Converted<'_, M>) -> Self { fn from(converted: &Converted<'_, M>) -> Self {
Self::from_map(converted) Self::new().map(converted)
} }
} }
+1 -1
View File
@@ -79,7 +79,7 @@ impl Beatmap {
/// Returns a [`BeatmapAttributesBuilder`] to calculate modified beatmap /// Returns a [`BeatmapAttributesBuilder`] to calculate modified beatmap
/// attributes. /// attributes.
pub const fn attributes(&self) -> BeatmapAttributesBuilder { pub const fn attributes(&self) -> BeatmapAttributesBuilder {
BeatmapAttributesBuilder::from_map(self) BeatmapAttributesBuilder::new().map(self)
} }
/// The beats per minute of the map. /// The beats per minute of the map.