pub struct IntRange { /* private fields */ }Expand description
A range that defines a discrete linear range of i32 values
Implementations§
Source§impl IntRange
impl IntRange
pub const fn min(&self) -> i32
pub const fn max(&self) -> i32
pub const fn span(&self) -> i32
pub const fn span_f32(&self) -> f32
pub fn clamp(&self, value: i32) -> i32
Sourcepub fn param(&self, value: i32, default: i32) -> NormalParam
pub fn param(&self, value: i32, default: i32) -> NormalParam
Creates a new NormalParam with values mapped
from this range.
value- The inital value of the parameter.default_value- The default value of the parameter.
Sourcepub fn default_param(&self) -> NormalParam
pub fn default_param(&self) -> NormalParam
Creates a new NormalParam with values mapped
from this range where value and default_value is 0.
Sourcepub fn snap(&self, normal: Normal) -> Normal
pub fn snap(&self, normal: Normal) -> Normal
Returns a Normal that is snapped to the closest integer
value in this range.
Sourcepub fn map(&self, value: i32) -> Normal
pub fn map(&self, value: i32) -> Normal
Returns the corresponding Normal from the supplied value
Sourcepub fn unmap_to_value(&self, normal: Normal) -> i32
pub fn unmap_to_value(&self, normal: Normal) -> i32
Returns the corresponding value from the supplied Normal
Trait Implementations§
impl Copy for IntRange
impl Eq for IntRange
impl StructuralPartialEq for IntRange
Auto Trait Implementations§
impl Freeze for IntRange
impl RefUnwindSafe for IntRange
impl Send for IntRange
impl Sync for IntRange
impl Unpin for IntRange
impl UnsafeUnpin for IntRange
impl UnwindSafe for IntRange
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
Mutably borrows from an owned value. Read more