`#[repr(C)]pub struct Length<T, Unit>(pub T, _);`

## Expand description

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::Scale`

to convert it from one unit to
another. See the `Scale`

docs for an example.

## Tuple Fields§

§`0: T`

## Implementations§

source§### impl<T: Clone, U> Length<T, U>

### impl<T: Clone, U> Length<T, U>

source#### pub 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§### 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: PartialEq, U> PartialEq for Length<T, U>

### impl<T: PartialEq, U> PartialEq for Length<T, U>

source§### impl<T: PartialOrd, U> PartialOrd for Length<T, U>

### impl<T: PartialOrd, U> PartialOrd for Length<T, U>

1.0.0 · source§#### fn le(&self, other: &Rhs) -> bool

#### fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for

`self`

and `other`

) and is used by the `<=`

operator. Read moresource§### 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 moresource§### impl<'a, T: 'a + Add<Output = T> + Copy + Zero, U: 'a> Sum<&'a Length<T, U>> for Length<T, U>

### impl<'a, T: 'a + Add<Output = T> + Copy + Zero, U: 'a> Sum<&'a Length<T, U>> for Length<T, U>

### impl<T: Copy, U> Copy for Length<T, U>

### impl<T: Eq, U> Eq for Length<T, U>

## Auto Trait Implementations§

### impl<T, Unit> Freeze for Length<T, Unit>where
T: Freeze,

### impl<T, Unit> RefUnwindSafe for Length<T, Unit>where
T: RefUnwindSafe,
Unit: RefUnwindSafe,

### impl<T, Unit> Send for Length<T, Unit>

### impl<T, Unit> Sync for Length<T, Unit>

### impl<T, Unit> Unpin for Length<T, Unit>

### impl<T, Unit> UnwindSafe for Length<T, Unit>where
T: UnwindSafe,
Unit: UnwindSafe,

## Blanket Implementations§

source§### impl<T> BorrowMut<T> for Twhere
T: ?Sized,

### impl<T> BorrowMut<T> for Twhere
T: ?Sized,

source§#### fn borrow_mut(&mut self) -> &mut T

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more