[−][src]Struct mag::Length
A measurement of physical length, distance or range.
Length is a base quantity with a specific unit.
Operations
- Length
+
Length=>
Length - Length
-
Length=>
Length - Length
*
f64=>
Length - f64
*
Length=>
Length - f64
*
unit=>
Length - Length
*
Length=>
Area - Length
*
unit=>
Area - Length
/
f64=>
Length
Units must be the same for operations with two Length operands. The to method can be used for conversion.
Example
use mag::{Length, length::In}; let a = 5.5 * In; let b = 4.5 * In; assert_eq!(a.to_string(), "5.5 in"); assert_eq!(a + b, 10.0 * In);
Fields
quantity: f64
Length quantity
Methods
impl<U> Length<U> where
U: Unit,
[src]
U: Unit,
pub fn new(quantity: f64) -> Self
[src]
Create a new length measurement
pub fn to<T: Unit>(self) -> Length<T>
[src]
Convert to specified units
Trait Implementations
impl<U: Clone> Clone for Length<U> where
U: Unit,
[src]
U: Unit,
impl<U: Copy> Copy for Length<U> where
U: Unit,
[src]
U: Unit,
impl<U: PartialEq> PartialEq<Length<U>> for Length<U> where
U: Unit,
[src]
U: Unit,
impl<U> Display for Length<U> where
U: Unit,
[src]
U: Unit,
impl<U: Debug> Debug for Length<U> where
U: Unit,
[src]
U: Unit,
impl<U> Div<f64> for Length<U> where
U: Unit,
[src]
U: Unit,
type Output = Self
The resulting type after applying the /
operator.
fn div(self, scalar: f64) -> Self::Output
[src]
impl<U> Div<Length<U>> for Area<U> where
U: Unit,
[src]
U: Unit,
type Output = Length<U>
The resulting type after applying the /
operator.
fn div(self, other: Length<U>) -> Self::Output
[src]
impl<U> Div<Length<U>> for Volume<U> where
U: Unit,
[src]
U: Unit,
type Output = Area<U>
The resulting type after applying the /
operator.
fn div(self, other: Length<U>) -> Self::Output
[src]
impl<L> Div<Gs> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, Gs>
The resulting type after applying the /
operator.
fn div(self, _unit: Gs) -> Self::Output
[src]
impl<L> Div<Ms> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, Ms>
The resulting type after applying the /
operator.
fn div(self, _unit: Ms) -> Self::Output
[src]
impl<L> Div<Ks> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, Ks>
The resulting type after applying the /
operator.
fn div(self, _unit: Ks) -> Self::Output
[src]
impl<L> Div<wk> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, wk>
The resulting type after applying the /
operator.
fn div(self, _unit: wk) -> Self::Output
[src]
impl<L> Div<d> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, d>
The resulting type after applying the /
operator.
fn div(self, _unit: d) -> Self::Output
[src]
impl<L> Div<h> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, h>
The resulting type after applying the /
operator.
fn div(self, _unit: h) -> Self::Output
[src]
impl<L> Div<min> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, min>
The resulting type after applying the /
operator.
fn div(self, _unit: min) -> Self::Output
[src]
impl<L> Div<s> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, s>
The resulting type after applying the /
operator.
fn div(self, _unit: s) -> Self::Output
[src]
impl<L> Div<ds> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, ds>
The resulting type after applying the /
operator.
fn div(self, _unit: ds) -> Self::Output
[src]
impl<L> Div<ms> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, ms>
The resulting type after applying the /
operator.
fn div(self, _unit: ms) -> Self::Output
[src]
impl<L> Div<us> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, us>
The resulting type after applying the /
operator.
fn div(self, _unit: us) -> Self::Output
[src]
impl<L> Div<ns> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, ns>
The resulting type after applying the /
operator.
fn div(self, _unit: ns) -> Self::Output
[src]
impl<L> Div<ps> for Length<L> where
L: Unit,
[src]
L: Unit,
type Output = Speed<L, ps>
The resulting type after applying the /
operator.
fn div(self, _unit: ps) -> Self::Output
[src]
impl<L, T> Div<Period<T>> for Length<L> where
L: Unit,
T: Unit,
[src]
L: Unit,
T: Unit,
type Output = Speed<L, T>
The resulting type after applying the /
operator.
fn div(self, per: Period<T>) -> Self::Output
[src]
impl<U> Sub<Length<U>> for Length<U> where
U: Unit,
[src]
U: Unit,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: Self) -> Self::Output
[src]
impl<U> Add<Length<U>> for Length<U> where
U: Unit,
[src]
U: Unit,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self::Output
[src]
impl Mul<km> for Length<km>
[src]
type Output = Area<km>
The resulting type after applying the *
operator.
fn mul(self, _unit: km) -> Self::Output
[src]
impl Mul<m> for Length<m>
[src]
type Output = Area<m>
The resulting type after applying the *
operator.
fn mul(self, _unit: m) -> Self::Output
[src]
impl Mul<dm> for Length<dm>
[src]
type Output = Area<dm>
The resulting type after applying the *
operator.
fn mul(self, _unit: dm) -> Self::Output
[src]
impl Mul<cm> for Length<cm>
[src]
type Output = Area<cm>
The resulting type after applying the *
operator.
fn mul(self, _unit: cm) -> Self::Output
[src]
impl Mul<mm> for Length<mm>
[src]
type Output = Area<mm>
The resulting type after applying the *
operator.
fn mul(self, _unit: mm) -> Self::Output
[src]
impl Mul<um> for Length<um>
[src]
type Output = Area<um>
The resulting type after applying the *
operator.
fn mul(self, _unit: um) -> Self::Output
[src]
impl Mul<nm> for Length<nm>
[src]
type Output = Area<nm>
The resulting type after applying the *
operator.
fn mul(self, _unit: nm) -> Self::Output
[src]
impl Mul<mi> for Length<mi>
[src]
type Output = Area<mi>
The resulting type after applying the *
operator.
fn mul(self, _unit: mi) -> Self::Output
[src]
impl Mul<ft> for Length<ft>
[src]
type Output = Area<ft>
The resulting type after applying the *
operator.
fn mul(self, _unit: ft) -> Self::Output
[src]
impl Mul<In> for Length<In>
[src]
type Output = Area<In>
The resulting type after applying the *
operator.
fn mul(self, _unit: In) -> Self::Output
[src]
impl Mul<yd> for Length<yd>
[src]
type Output = Area<yd>
The resulting type after applying the *
operator.
fn mul(self, _unit: yd) -> Self::Output
[src]
impl<U> Mul<f64> for Length<U> where
U: Unit,
[src]
U: Unit,
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, scalar: f64) -> Self::Output
[src]
impl<U> Mul<Length<U>> for f64 where
U: Unit,
[src]
U: Unit,
type Output = Length<U>
The resulting type after applying the *
operator.
fn mul(self, other: Length<U>) -> Self::Output
[src]
impl<U> Mul<Length<U>> for Length<U> where
U: Unit,
[src]
U: Unit,
type Output = Area<U>
The resulting type after applying the *
operator.
fn mul(self, other: Self) -> Self::Output
[src]
impl<U> Mul<Length<U>> for Area<U> where
U: Unit,
[src]
U: Unit,
type Output = Volume<U>
The resulting type after applying the *
operator.
fn mul(self, other: Length<U>) -> Self::Output
[src]
impl<L, T> Mul<Length<L>> for Frequency<T> where
L: Unit,
T: Unit,
[src]
L: Unit,
T: Unit,
type Output = Speed<L, T>
The resulting type after applying the *
operator.
fn mul(self, len: Length<L>) -> Self::Output
[src]
impl<L, T> Mul<Frequency<T>> for Length<L> where
L: Unit,
T: Unit,
[src]
L: Unit,
T: Unit,
type Output = Speed<L, T>
The resulting type after applying the *
operator.
fn mul(self, freq: Frequency<T>) -> Self::Output
[src]
impl<U> StructuralPartialEq for Length<U> where
U: Unit,
[src]
U: Unit,
Auto Trait Implementations
impl<U> Send for Length<U> where
U: Send,
U: Send,
impl<U> Sync for Length<U> where
U: Sync,
U: Sync,
impl<U> Unpin for Length<U> where
U: Unpin,
U: Unpin,
impl<U> UnwindSafe for Length<U> where
U: UnwindSafe,
U: UnwindSafe,
impl<U> RefUnwindSafe for Length<U> where
U: RefUnwindSafe,
U: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,