Implementations
sourceimpl<N: Number + Float, U: Unit> Value<N, U>
impl<N: Number + Float, U: Unit> Value<N, U>
sourcepub fn lerp(self, other: Value<N, U>, t: N) -> Value<N, U>
pub fn lerp(self, other: Value<N, U>, t: N) -> Value<N, U>
Linearly interpolated the value of self
and other
by the value t
where 0 is self and 1 is other.
Arguments
other
: The target value.t
: A value which says where the value should be.
returns: Vec2D<N, U>
Examples
let v0 = mathie::Value::new_any(1.0);
let other = mathie::Value::new_any(2.0);
assert_eq!(v0.lerp(other, 0.0), v0);
assert_eq!(v0.lerp(other, 1.0), other);
assert_eq!(v0.lerp(other, 0.5), mathie::Value::new_any(1.5));
sourceimpl<N: Number, U: Unit> Value<N, U>
impl<N: Number, U: Unit> Value<N, U>
pub const fn new_u(value: N, unit: U) -> Value<N, U>
pub fn cast<NO: Number>(self) -> Option<Value<NO, U>>
pub fn convert_def<UO: UnitCompatibility<N, U> + Default>(
self
) -> Option<Value<N, UO>>
pub fn convert_u<UO: UnitCompatibility<N, U>>(
self,
to: UO
) -> Option<Value<N, UO>>
pub fn any_unit(self) -> Value<N, ()>
pub fn unit(self) -> U
pub fn val(self) -> N
Trait Implementations
sourceimpl<T: Number, U: Unit> AddAssign<T> for Value<T, U>
impl<T: Number, U: Unit> AddAssign<T> for Value<T, U>
sourcefn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the +=
operation. Read more
sourceimpl<T: Number, U: Unit> AddAssign<Value<T, U>> for Value<T, U>
impl<T: Number, U: Unit> AddAssign<Value<T, U>> for Value<T, U>
sourcefn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the +=
operation. Read more
sourceimpl<T: Number, U: Unit> DivAssign<T> for Value<T, U>
impl<T: Number, U: Unit> DivAssign<T> for Value<T, U>
sourcefn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the /=
operation. Read more
sourceimpl<T: Number, U: Unit> DivAssign<Value<T, U>> for Value<T, U>
impl<T: Number, U: Unit> DivAssign<Value<T, U>> for Value<T, U>
sourcefn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the /=
operation. Read more
sourceimpl<T: Number, U: Unit> MulAssign<T> for Value<T, U>
impl<T: Number, U: Unit> MulAssign<T> for Value<T, U>
sourcefn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the *=
operation. Read more
sourceimpl<T: Number, U: Unit> MulAssign<Value<T, U>> for Value<T, U>
impl<T: Number, U: Unit> MulAssign<Value<T, U>> for Value<T, U>
sourcefn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the *=
operation. Read more
sourceimpl<N: Number + Ord, U: Unit> Ord for Value<N, U>
impl<N: Number + Ord, U: Unit> Ord for Value<N, U>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<N: Number, U: Unit> PartialOrd<Value<N, U>> for Value<N, U>
impl<N: Number, U: Unit> PartialOrd<Value<N, U>> for Value<N, U>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<T: Number, U: Unit> RemAssign<T> for Value<T, U>
impl<T: Number, U: Unit> RemAssign<T> for Value<T, U>
sourcefn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
Performs the %=
operation. Read more
sourceimpl<T: Number, U: Unit> RemAssign<Value<T, U>> for Value<T, U>
impl<T: Number, U: Unit> RemAssign<Value<T, U>> for Value<T, U>
sourcefn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
Performs the %=
operation. Read more
sourceimpl<T: Number, U: Unit> SubAssign<T> for Value<T, U>
impl<T: Number, U: Unit> SubAssign<T> for Value<T, U>
sourcefn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the -=
operation. Read more
sourceimpl<T: Number, U: Unit> SubAssign<Value<T, U>> for Value<T, U>
impl<T: Number, U: Unit> SubAssign<Value<T, U>> for Value<T, U>
sourcefn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the -=
operation. Read more
impl<N: Copy + Number, U: Copy + Unit> Copy for Value<N, U>
impl<N: Number, U: Unit> Eq for Value<N, U>
Auto Trait Implementations
impl<N, U> RefUnwindSafe for Value<N, U> where
N: RefUnwindSafe,
U: RefUnwindSafe,
impl<N, U> Send for Value<N, U> where
N: Send,
U: Send,
impl<N, U> Sync for Value<N, U> where
N: Sync,
U: Sync,
impl<N, U> Unpin for Value<N, U> where
N: Unpin,
U: Unpin,
impl<N, U> UnwindSafe for Value<N, U> where
N: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more