Struct gdnative_visual_script::common::geom::euclid::Length [−]
#[repr(C)]pub struct Length<T, Unit>(pub T, _);
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
pub fn get(&self) -> Timpl<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
T1: Clone + NumCast,
pub fn cast<T1>(&self) -> Length<T1, Unit> where
T1: Clone + NumCast, Cast from one numeric representation to another, preserving the units.
pub fn try_cast<T1>(&self) -> Option<Length<T1, Unit>> where
T1: Clone + NumCast,
pub fn try_cast<T1>(&self) -> Option<Length<T1, Unit>> where
T1: Clone + NumCast, 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>
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> 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>
fn neg(self) -> Length<T, U>Performs the unary - operation.
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 cmp(&self, other: &Length<T, Unit>) -> OrderingThis method returns an Ordering between self and other. Read more
fn max(self, other: Self) -> Self1.21.0[src]
fn max(self, other: Self) -> SelfCompares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
fn min(self, other: Self) -> SelfCompares and returns the minimum of two values. Read more
impl<T, Unit> Copy for Length<T, Unit> where
T: Copy,
impl<T, Unit> Copy for Length<T, Unit> where
T: Copy, 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)
fn div_assign(&mut self, scale: T)Performs the /= operation.
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>
fn mul(self, scale: T) -> Length<T, U>Performs the * operation.
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>
fn mul(self, scale: TypedScale<T, Src, Dst>) -> Length<T, Dst>Performs the * operation.
impl<T, U> Debug for Length<T, U> where
T: Clone + Debug,
impl<T, U> Debug for Length<T, U> where
T: Clone + Debug, fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>Formats the value using the given formatter. Read more
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>)
fn sub_assign(&mut self, other: Length<T, U>)Performs the -= operation.
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)
fn mul_assign(&mut self, scale: T)Performs the *= operation.
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_add(self, other: Length<T, U>) -> Length<T, U>Saturating addition operator. Returns a+b, saturating at the numeric bounds instead of overflowing. Read more
fn saturating_sub(self, other: Length<T, U>) -> Length<T, U>
fn saturating_sub(self, other: Length<T, U>) -> Length<T, U>Saturating subtraction operator. Returns a-b, saturating at the numeric bounds instead of overflowing. Read more
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(&self) -> Length<T, Unit>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, U> Display for Length<T, U> where
T: Clone + Display,
impl<T, U> Display for Length<T, U> where
T: Clone + Display, fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>Formats the value using the given formatter. Read more
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
fn sub(self, other: Length<T, U>) -> <Length<T, U> as Sub<Length<T, U>>>::OutputPerforms the - operation.
impl<Unit, T> Zero for Length<T, Unit> where
T: Zero,
impl<Unit, T> Zero for Length<T, Unit> where
T: Zero, 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>
fn partial_cmp(&self, other: &Length<T, Unit>) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool1.0.0[src]
fn lt(&self, other: &Rhs) -> boolThis method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &Rhs) -> bool1.0.0[src]
fn le(&self, other: &Rhs) -> boolThis method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &Rhs) -> bool1.0.0[src]
fn gt(&self, other: &Rhs) -> boolThis method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &Rhs) -> bool1.0.0[src]
fn ge(&self, other: &Rhs) -> boolThis method tests greater than or equal to (for self and other) and is used by the >= operator. 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>
fn add(self, other: Length<T, U>) -> Length<T, U>Performs the + operation.
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>
fn div(self, other: Length<T, Src>) -> TypedScale<T, Src, Dst>Performs the / operation.
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>
fn div(self, scale: TypedScale<T, Src, Dst>) -> Length<T, Src>Performs the / operation.
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>
fn div(self, scale: T) -> Length<T, U>Performs the / operation.
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>)
fn add_assign(&mut self, other: Length<T, U>)Performs the += operation.
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
fn eq(&self, other: &Length<T, Unit>) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
fn ne(&self, other: &Rhs) -> boolThis 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,