Struct clampf::Clamp [−][src]
pub struct Clamp<T: Float>(_);
A wrapper around a floating-point value clamped to the range [0,1].
Methods
impl<T: Float> Clamp<T>
[src]
impl<T: Float> Clamp<T>
pub unsafe fn new_unchecked(value: T) -> Self
[src]
pub unsafe fn new_unchecked(value: T) -> Self
Creates a new wrapper around the value without checking.
Safety
The value must be in the range [0,1].
pub fn new(value: T) -> Self
[src]
pub fn new(value: T) -> Self
Creates a new wrapper around the value.
pub unsafe fn set_unchecked(&mut self, value: T)
[src]
pub unsafe fn set_unchecked(&mut self, value: T)
pub fn set(&mut self, value: T)
[src]
pub fn set(&mut self, value: T)
Sets the contained value.
pub unsafe fn update_unchecked<F>(&mut self, func: F) where
F: FnOnce(T) -> T,
[src]
pub unsafe fn update_unchecked<F>(&mut self, func: F) where
F: FnOnce(T) -> T,
Updates the contained value using a function without checking.
Safety
The value produced by a function must be in the range [0,1].
pub fn update<F>(&mut self, func: F) where
F: FnOnce(T) -> T,
[src]
pub fn update<F>(&mut self, func: F) where
F: FnOnce(T) -> T,
Updates the contained value using a function.
pub fn get(&self) -> T
[src]
pub fn get(&self) -> T
Returns the contained value.
Trait Implementations
impl<T: Clone + Float> Clone for Clamp<T>
[src]
impl<T: Clone + Float> Clone for Clamp<T>
fn clone(&self) -> Clamp<T>
[src]
fn clone(&self) -> Clamp<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Copy + Float> Copy for Clamp<T>
[src]
impl<T: Copy + Float> Copy for Clamp<T>
impl<T: PartialEq + Float> PartialEq for Clamp<T>
[src]
impl<T: PartialEq + Float> PartialEq for Clamp<T>
fn eq(&self, other: &Clamp<T>) -> bool
[src]
fn eq(&self, other: &Clamp<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Clamp<T>) -> bool
[src]
fn ne(&self, other: &Clamp<T>) -> bool
This method tests for !=
.
impl<T: PartialOrd + Float> PartialOrd for Clamp<T>
[src]
impl<T: PartialOrd + Float> PartialOrd for Clamp<T>
fn partial_cmp(&self, other: &Clamp<T>) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Clamp<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Clamp<T>) -> bool
[src]
fn lt(&self, other: &Clamp<T>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Clamp<T>) -> bool
[src]
fn le(&self, other: &Clamp<T>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Clamp<T>) -> bool
[src]
fn gt(&self, other: &Clamp<T>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Clamp<T>) -> bool
[src]
fn ge(&self, other: &Clamp<T>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Debug + Float> Debug for Clamp<T>
[src]
impl<T: Debug + Float> Debug for Clamp<T>
fn fmt(&self, fmter: &mut Formatter) -> Result
[src]
fn fmt(&self, fmter: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: Display + Float> Display for Clamp<T>
[src]
impl<T: Display + Float> Display for Clamp<T>
fn fmt(&self, fmter: &mut Formatter) -> Result
[src]
fn fmt(&self, fmter: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: LowerExp + Float> LowerExp for Clamp<T>
[src]
impl<T: LowerExp + Float> LowerExp for Clamp<T>
impl<T: UpperExp + Float> UpperExp for Clamp<T>
[src]
impl<T: UpperExp + Float> UpperExp for Clamp<T>
impl<T: Float> Default for Clamp<T>
[src]
impl<T: Float> Default for Clamp<T>
impl<T: Float> Bounded for Clamp<T>
[src]
impl<T: Float> Bounded for Clamp<T>