pub type Length<T> = Length<T, UnknownUnit>;
Aliased Type§
struct Length<T>(pub T, _);
Fields§
§0: T
Implementations
Source§impl<T: Clone, U> Length<T, U>
impl<T: Clone, U> Length<T, U>
Sourcepub fn lerp(self, other: Self, t: T) -> Self
pub fn lerp(self, other: Self, t: T) -> Self
Linearly interpolate between this length and another length.
§Example
use euclid::default::Length;
let from = Length::new(0.0);
let to = Length::new(8.0);
assert_eq!(from.lerp(to, -1.0), Length::new(-8.0));
assert_eq!(from.lerp(to, 0.0), Length::new( 0.0));
assert_eq!(from.lerp(to, 0.5), Length::new( 4.0));
assert_eq!(from.lerp(to, 1.0), Length::new( 8.0));
assert_eq!(from.lerp(to, 2.0), Length::new(16.0));
Source§impl<T: PartialOrd, U> Length<T, U>
impl<T: PartialOrd, U> Length<T, U>
Trait Implementations
Source§impl<T: AddAssign, U> AddAssign for Length<T, U>
impl<T: AddAssign, U> AddAssign for Length<T, U>
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+=
operation. Read moreSource§impl<U, T: ApproxEq<T>> ApproxEq<T> for Length<T, U>
impl<U, T: ApproxEq<T>> ApproxEq<T> for Length<T, U>
Source§fn approx_epsilon() -> T
fn approx_epsilon() -> T
Default epsilon value
Source§fn approx_eq_eps(&self, other: &Length<T, U>, approx_epsilon: &T) -> bool
fn approx_eq_eps(&self, other: &Length<T, U>, approx_epsilon: &T) -> bool
Returns
true
if this object is approximately equal to the other one, using
a provided epsilon value.Source§fn approx_eq(&self, other: &Self) -> bool
fn approx_eq(&self, other: &Self) -> bool
Returns
true
if this object is approximately equal to the other one, using
the approx_epsilon
epsilon value.Source§impl<'de, T, U> Deserialize<'de> for Length<T, U>where
T: Deserialize<'de>,
impl<'de, T, U> Deserialize<'de> for Length<T, U>where
T: Deserialize<'de>,
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: Copy + Div<T, Output = T>, U> DivAssign<T> for Length<T, U>
impl<T: Copy + Div<T, Output = T>, U> DivAssign<T> for Length<T, U>
Source§fn div_assign(&mut self, scale: T)
fn div_assign(&mut self, scale: T)
Performs the
/=
operation. Read moreSource§impl<T: Copy + Mul<T, Output = T>, U> MulAssign<T> for Length<T, U>
impl<T: Copy + Mul<T, Output = T>, U> MulAssign<T> for Length<T, U>
Source§fn mul_assign(&mut self, scale: T)
fn mul_assign(&mut self, scale: T)
Performs the
*=
operation. Read moreSource§impl<T: Ord, U> Ord for Length<T, U>
impl<T: Ord, U> Ord for Length<T, U>
Source§impl<T: PartialOrd, U> PartialOrd for Length<T, U>
impl<T: PartialOrd, U> PartialOrd for Length<T, U>
Source§impl<T: Saturating, U> Saturating for Length<T, U>
impl<T: Saturating, U> Saturating for Length<T, U>
Source§fn saturating_add(self, other: Self) -> Self
fn saturating_add(self, other: Self) -> Self
Saturating addition operator.
Returns a+b, saturating at the numeric bounds instead of overflowing.
Source§fn saturating_sub(self, other: Self) -> Self
fn saturating_sub(self, other: Self) -> Self
Saturating subtraction operator.
Returns a-b, saturating at the numeric bounds instead of overflowing.
Source§impl<T: SubAssign, U> SubAssign for Length<T, U>
impl<T: SubAssign, U> SubAssign for Length<T, U>
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-=
operation. Read more