pub struct PercentageValue { /* private fields */ }Expand description
Wrapper around FloatValue, represents a percentage instead
of just being a regular floating-point value, i.e 5 = 5%
Implementations§
Source§impl PercentageValue
impl PercentageValue
Sourcepub const fn const_new(value: isize) -> Self
pub const fn const_new(value: isize) -> Self
Same as PercentageValue::new(), but only accepts whole numbers,
since using f32 in const fn is not yet stabilized.
pub fn new(value: f32) -> Self
pub fn get(&self) -> f32
pub fn normalized(&self) -> f32
pub fn interpolate(&self, other: &Self, t: f32) -> Self
Trait Implementations§
Source§impl Clone for PercentageValue
impl Clone for PercentageValue
Source§fn clone(&self) -> PercentageValue
fn clone(&self) -> PercentageValue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PercentageValue
impl Debug for PercentageValue
Source§impl Default for PercentageValue
impl Default for PercentageValue
Source§fn default() -> PercentageValue
fn default() -> PercentageValue
Returns the “default value” for a type. Read more
Source§impl Display for PercentageValue
impl Display for PercentageValue
Source§impl Hash for PercentageValue
impl Hash for PercentageValue
Source§impl Ord for PercentageValue
impl Ord for PercentageValue
Source§fn cmp(&self, other: &PercentageValue) -> Ordering
fn cmp(&self, other: &PercentageValue) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PercentageValue
impl PartialEq for PercentageValue
Source§impl PartialOrd for PercentageValue
impl PartialOrd for PercentageValue
impl Copy for PercentageValue
impl Eq for PercentageValue
impl StructuralPartialEq for PercentageValue
Auto Trait Implementations§
impl Freeze for PercentageValue
impl RefUnwindSafe for PercentageValue
impl Send for PercentageValue
impl Sync for PercentageValue
impl Unpin for PercentageValue
impl UnwindSafe for PercentageValue
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