Struct rosu_map::section::hit_objects::SliderPath
source · pub struct SliderPath { /* private fields */ }Expand description
The path of a HitObjectSlider.
Implementations§
source§impl SliderPath
impl SliderPath
sourcepub const fn new(
control_points: Vec<PathControlPoint>,
expected_dist: Option<f64>,
) -> Self
pub const fn new( control_points: Vec<PathControlPoint>, expected_dist: Option<f64>, ) -> Self
Creates a new SliderPath.
The contained Curve will not necessarily be calculated yet, only
when accessing it with methods such as SliderPath::curve.
sourcepub fn control_points(&self) -> &[PathControlPoint]
pub fn control_points(&self) -> &[PathControlPoint]
Returns an immutable reference to the control points.
sourcepub const fn expected_dist(&self) -> Option<f64>
pub const fn expected_dist(&self) -> Option<f64>
Returns the expected distance.
sourcepub fn curve(&mut self) -> &Curve
pub fn curve(&mut self) -> &Curve
Returns a reference to the Curve.
If the curve has not yet been accessed, it needs to be calculated first.
In case curves of multiple slider paths are being calculated, it is
recommended to initialize CurveBuffers and pass a mutable reference
of it to SliderPath::curve_with_bufs so the buffers are re-used for
all sliders.
Alternatively, to avoid storing the curve altogether because it will be
accessed only once, using SliderPath::borrowed_curve should be
preferred.
sourcepub fn curve_with_bufs(&mut self, bufs: &mut CurveBuffers) -> &Curve
pub fn curve_with_bufs(&mut self, bufs: &mut CurveBuffers) -> &Curve
Returns a reference to the Curve.
If the curve has not yet been accessed, it needs to be calculated first.
In case the curve will be accessed only once, using
SliderPath::borrowed_curve should be preferred.
sourcepub fn borrowed_curve<'a, 'b: 'a>(
&'a self,
bufs: &'b mut CurveBuffers,
) -> BorrowedCurve<'_>
pub fn borrowed_curve<'a, 'b: 'a>( &'a self, bufs: &'b mut CurveBuffers, ) -> BorrowedCurve<'_>
Returns a BorrowedCurve.
If the curve has been calculated before, the returned curve will borrow
from it. Otherwise, it will be calculated and returned without
storing it by borrowing from the given CurveBuffers.
This should be preferred over SliderPath::curve_with_bufs if the
curve will be accessed only once.
sourcepub fn control_points_mut(&mut self) -> &mut Vec<PathControlPoint>
pub fn control_points_mut(&mut self) -> &mut Vec<PathControlPoint>
Returns a mutable reference to the control points.
Note that calling this method will invalidate the stored curve so it must be recalculated on its next access.
sourcepub fn expected_dist_mut(&mut self) -> &mut Option<f64>
pub fn expected_dist_mut(&mut self) -> &mut Option<f64>
Returns a mutable reference to the expected distance.
Note that calling this method will invalidate the stored curve so it must be recalculated on its next access.
sourcepub fn clear_curve(&mut self)
pub fn clear_curve(&mut self)
Remove the stored curve so that it has to be re-calculated when accessing it the next time.
Trait Implementations§
source§impl Clone for SliderPath
impl Clone for SliderPath
source§fn clone(&self) -> SliderPath
fn clone(&self) -> SliderPath
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for SliderPath
impl Debug for SliderPath
source§impl PartialEq for SliderPath
impl PartialEq for SliderPath
Auto Trait Implementations§
impl Freeze for SliderPath
impl RefUnwindSafe for SliderPath
impl Send for SliderPath
impl Sync for SliderPath
impl Unpin for SliderPath
impl UnwindSafe for SliderPath
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)