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<Unit, T> Length<T, Unit> where
    T: Clone

impl<Unit, T0> Length<T0, Unit> where
    T0: Clone + NumCast

Cast from one numeric representation to another, preserving the units.

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

Linearly interpolate between this length and another length.

t is expected to be between zero and one.

Trait Implementations

impl<Unit, T> Eq for Length<T, Unit> where
    T: Eq + Clone

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>, 

Performs the /= operation.

impl<Unit, T> Ord for Length<T, Unit> where
    T: Ord + Clone

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl<T, U> Mul<T> for Length<T, U> where
    T: Copy + Mul<T, Output = T>, 

The resulting type after applying the * operator.

Performs the * operation.

impl<Src, Dst, T> Mul<TypedScale<T, Src, Dst>> for Length<T, Src> where
    T: Mul<T, Output = T> + Clone

The resulting type after applying the * operator.

Performs the * operation.

impl<T, U> Debug for Length<T, U> where
    T: Clone + Debug

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

Performs the -= operation.

impl<T, U> MulAssign<T> for Length<T, U> where
    T: Copy + Mul<T, Output = T>, 

Performs the *= operation.

impl<T, Unit> Clone for Length<T, Unit> where
    T: Clone

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T, U> Display for Length<T, U> where
    T: Clone + Display

Formats the value using the given formatter. Read more

impl<U, T> Saturating for Length<T, U> where
    T: Clone + Saturating

Saturating addition operator. Returns a+b, saturating at the numeric bounds instead of overflowing. Read more

Saturating subtraction operator. Returns a-b, saturating at the numeric bounds instead of overflowing. Read more

impl<U, T> Sub<Length<T, U>> for Length<T, U> where
    T: Sub<T, Output = T> + Clone

The resulting type after applying the - operator.

Performs the - operation.

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

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This 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

The resulting type after applying the + operator.

Performs the + operation.

impl<U, T> AddAssign<Length<T, U>> for Length<T, U> where
    T: AddAssign<T> + Clone

Performs the += operation.

impl<Src, Dst, T> Div<Length<T, Src>> for Length<T, Dst> where
    T: Div<T, Output = T> + Clone

The resulting type after applying the / operator.

Performs the / operation.

impl<Src, Dst, T> Div<TypedScale<T, Src, Dst>> for Length<T, Dst> where
    T: Div<T, Output = T> + Clone

The resulting type after applying the / operator.

Performs the / operation.

impl<T, U> Div<T> for Length<T, U> where
    T: Copy + Div<T, Output = T>, 

The resulting type after applying the / operator.

Performs the / operation.

impl<Unit, T> PartialEq<Length<T, Unit>> for Length<T, Unit> where
    T: PartialEq<T> + Clone

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<U, T> Neg for Length<T, U> where
    T: Neg<Output = T> + Clone

The resulting type after applying the - operator.

Performs the unary - operation.

Auto Trait Implementations

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