[−]Struct gdnative_core::euclid::Length
A one-dimensional distance, with value represented by T and unit of measurement Unit.
T can be any numeric type, for example a primitive type like u64 or f32.
Unit is not used in the representation of a Length value. It is used only at compile time
to ensure that a Length stored with one unit is converted explicitly before being used in an
expression that requires a different unit. It may be a type without values, such as an empty
enum.
You can multiply a Length by a scale::TypedScale to convert it from one unit to
another. See the TypedScale docs for an example.
Methods
impl<T, Unit> Length<T, Unit>
impl<T, Unit> Length<T, Unit>impl<Unit, T> Length<T, Unit> where
T: Clone,
impl<Unit, T> Length<T, Unit> where
T: Clone, pub fn get(&self) -> T |
impl<Unit, T0> Length<T0, Unit> where
T0: Clone + NumCast,
impl<Unit, T0> Length<T0, Unit> where
T0: Clone + NumCast, pub fn cast<T1>(&self) -> Length<T1, Unit> where |
Cast from one numeric representation to another, preserving the units.
pub fn try_cast<T1>(&self) -> Option<Length<T1, Unit>> where |
Fallible cast from one numeric representation to another, preserving the units.
impl<T, U> Length<T, U> where
T: One + Add<T, Output = T> + Sub<T, Output = T> + Mul<T, Output = T> + Copy,
impl<T, U> Length<T, U> where
T: One + Add<T, Output = T> + Sub<T, Output = T> + Mul<T, Output = T> + Copy, pub fn lerp(&self, other: Length<T, U>, t: T) -> Length<T, U> |
Linearly interpolate between this length and another length.
t is expected to be between zero and one.
Trait Implementations
impl<U, T> SubAssign<Length<T, U>> for Length<T, U> where
T: SubAssign<T> + Clone,
impl<U, T> SubAssign<Length<T, U>> for Length<T, U> where
T: SubAssign<T> + Clone, fn sub_assign(&mut self, other: Length<T, U>) |
impl<T, U> MulAssign<T> for Length<T, U> where
T: Copy + Mul<T, Output = T>,
impl<T, U> MulAssign<T> for Length<T, U> where
T: Copy + Mul<T, Output = T>, fn mul_assign(&mut self, scale: T) |
impl<U, T> Sub<Length<T, U>> for Length<T, U> where
T: Sub<T, Output = T> + Clone,
impl<U, T> Sub<Length<T, U>> for Length<T, U> where
T: Sub<T, Output = T> + Clone, type Output = Length<T, U>
The resulting type after applying the - operator.
fn sub(self, other: Length<T, U>) -> <Length<T, U> as Sub<Length<T, U>>>::Output |
impl<Unit, T> PartialEq<Length<T, Unit>> for Length<T, Unit> where
T: PartialEq<T> + Clone,
impl<Unit, T> PartialEq<Length<T, Unit>> for Length<T, Unit> where
T: PartialEq<T> + Clone, fn eq(&self, other: &Length<T, Unit>) -> bool |
| 1.0.0 [src] |
This method tests for !=.
impl<Unit, T> Eq for Length<T, Unit> where
T: Eq + Clone,
impl<Unit, T> Eq for Length<T, Unit> where
T: Eq + Clone, impl<T, U> Display for Length<T, U> where
T: Clone + Display,
impl<T, U> Display for Length<T, U> where
T: Clone + Display, impl<Unit, T> Ord for Length<T, Unit> where
T: Ord + Clone,
impl<Unit, T> Ord for Length<T, Unit> where
T: Ord + Clone, fn cmp(&self, other: &Length<T, Unit>) -> Ordering |
fn max(self, other: Self) -> Self | 1.21.0 [src] |
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self | 1.21.0 [src] |
Compares and returns the minimum of two values. Read more
impl<U, T> Add<Length<T, U>> for Length<T, U> where
T: Add<T, Output = T> + Clone,
impl<U, T> Add<Length<T, U>> for Length<T, U> where
T: Add<T, Output = T> + Clone, type Output = Length<T, U>
The resulting type after applying the + operator.
fn add(self, other: Length<T, U>) -> Length<T, U> |
impl<T, Unit> Clone for Length<T, Unit> where
T: Clone,
impl<T, Unit> Clone for Length<T, Unit> where
T: Clone, fn clone(&self) -> Length<T, Unit> |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source. Read more
impl<T, U> Debug for Length<T, U> where
T: Clone + Debug,
impl<T, U> Debug for Length<T, U> where
T: Clone + Debug, impl<Src, Dst, T> Div<TypedScale<T, Src, Dst>> for Length<T, Dst> where
T: Div<T, Output = T> + Clone,
impl<Src, Dst, T> Div<TypedScale<T, Src, Dst>> for Length<T, Dst> where
T: Div<T, Output = T> + Clone, type Output = Length<T, Src>
The resulting type after applying the / operator.
fn div(self, scale: TypedScale<T, Src, Dst>) -> Length<T, Src> |
impl<Src, Dst, T> Div<Length<T, Src>> for Length<T, Dst> where
T: Div<T, Output = T> + Clone,
impl<Src, Dst, T> Div<Length<T, Src>> for Length<T, Dst> where
T: Div<T, Output = T> + Clone, type Output = TypedScale<T, Src, Dst>
The resulting type after applying the / operator.
fn div(self, other: Length<T, Src>) -> TypedScale<T, Src, Dst> |
impl<T, U> Div<T> for Length<T, U> where
T: Copy + Div<T, Output = T>,
impl<T, U> Div<T> for Length<T, U> where
T: Copy + Div<T, Output = T>, type Output = Length<T, U>
The resulting type after applying the / operator.
fn div(self, scale: T) -> Length<T, U> |
impl<U, T> AddAssign<Length<T, U>> for Length<T, U> where
T: AddAssign<T> + Clone,
impl<U, T> AddAssign<Length<T, U>> for Length<T, U> where
T: AddAssign<T> + Clone, fn add_assign(&mut self, other: Length<T, U>) |
impl<T, Unit> Copy for Length<T, Unit> where
T: Copy,
impl<T, Unit> Copy for Length<T, Unit> where
T: Copy, impl<U, T> Saturating for Length<T, U> where
T: Clone + Saturating,
impl<U, T> Saturating for Length<T, U> where
T: Clone + Saturating, fn saturating_add(self, other: Length<T, U>) -> Length<T, U> |
fn saturating_sub(self, other: Length<T, U>) -> Length<T, U> |
impl<Unit, T> PartialOrd<Length<T, Unit>> for Length<T, Unit> where
T: PartialOrd<T> + Clone,
impl<Unit, T> PartialOrd<Length<T, Unit>> for Length<T, Unit> where
T: PartialOrd<T> + Clone, fn partial_cmp(&self, other: &Length<T, Unit>) -> Option<Ordering> |
| 1.0.0 [src] |
This method tests less than (for self and other) and is used by the < operator. Read more
| 1.0.0 [src] |
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
| 1.0.0 [src] |
This method tests greater than (for self and other) and is used by the > operator. Read more
| 1.0.0 [src] |
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl<U, T> Neg for Length<T, U> where
T: Neg<Output = T> + Clone,
impl<U, T> Neg for Length<T, U> where
T: Neg<Output = T> + Clone, type Output = Length<T, U>
The resulting type after applying the - operator.
fn neg(self) -> Length<T, U> |
impl<Unit, T> Zero for Length<T, Unit> where
T: Zero,
impl<Unit, T> Zero for Length<T, Unit> where
T: Zero, impl<T, U> DivAssign<T> for Length<T, U> where
T: Copy + Div<T, Output = T>,
impl<T, U> DivAssign<T> for Length<T, U> where
T: Copy + Div<T, Output = T>, fn div_assign(&mut self, scale: T) |
impl<T, U> Mul<T> for Length<T, U> where
T: Copy + Mul<T, Output = T>,
impl<T, U> Mul<T> for Length<T, U> where
T: Copy + Mul<T, Output = T>, type Output = Length<T, U>
The resulting type after applying the * operator.
fn mul(self, scale: T) -> Length<T, U> |
impl<Src, Dst, T> Mul<TypedScale<T, Src, Dst>> for Length<T, Src> where
T: Mul<T, Output = T> + Clone,
impl<Src, Dst, T> Mul<TypedScale<T, Src, Dst>> for Length<T, Src> where
T: Mul<T, Output = T> + Clone, type Output = Length<T, Dst>
The resulting type after applying the * operator.
fn mul(self, scale: TypedScale<T, Src, Dst>) -> Length<T, Dst> |
Auto Trait Implementations
impl<T, Unit> Send for Length<T, Unit> where
T: Send,
Unit: Send,
impl<T, Unit> Send for Length<T, Unit> where
T: Send,
Unit: Send, impl<T, Unit> Sync for Length<T, Unit> where
T: Sync,
Unit: Sync,
impl<T, Unit> Sync for Length<T, Unit> where
T: Sync,
Unit: Sync, Blanket Implementations
impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, impl<T> ToString for T where
T: Display + ?Sized, [src]
impl<T> ToString for T where
T: Display + ?Sized, impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId | [src] |
impl<T> Zero for T where
T: Zero,
impl<T> Zero for T where
T: Zero, fn zero() -> T |