Struct euclid::length::Length
[−]
[src]
pub struct Length<Unit, T>(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_factor::ScaleFactor
to convert it from one unit to
another. See the ScaleFactor docs for an example.
Methods
impl<Unit, T> Length<Unit, T>
impl<Unit, T: Clone> Length<Unit, T>
fn get(&self) -> T
impl<Unit, T0: NumCast + Clone> Length<Unit, T0>
fn cast<T1: NumCast + Clone>(&self) -> Option<Length<Unit, T1>>
Cast from one numeric representation to another, preserving the units.