Struct geom::Distance[][src]

pub struct Distance(f64);

A distance, in meters. Can be negative.

Implementations

impl Distance[src]

pub const ZERO: Distance[src]

pub fn meters(value: f64) -> Distance[src]

Creates a distance in meters.

pub const fn const_meters(value: f64) -> Distance[src]

pub fn inches(value: f64) -> Distance[src]

Creates a distance in inches.

pub fn miles(value: f64) -> Distance[src]

Creates a distance in miles.

pub fn centimeters(value: usize) -> Distance[src]

Creates a distance in centimeters.

pub fn abs(self) -> Distance[src]

Returns the absolute value of this distance.

pub fn sqrt(self) -> Distance[src]

Returns the square root of this distance.

pub fn inner_meters(self) -> f64[src]

Returns the distance in meters. Prefer to work with type-safe Distances.

pub fn to_feet(self) -> f64[src]

Returns the distance in feet.

pub fn to_string(self, fmt: &UnitFmt) -> String[src]

Describes the distance according to formatting rules.

Trait Implementations

impl Add<Distance> for Distance[src]

type Output = Distance

The resulting type after applying the + operator.

impl AddAssign<Distance> for Distance[src]

impl Clone for Distance[src]

impl Copy for Distance[src]

impl Debug for Distance[src]

impl Default for Distance[src]

impl<'de> Deserialize<'de> for Distance[src]

impl Display for Distance[src]

impl Div<Distance> for Distance[src]

type Output = f64

The resulting type after applying the / operator.

impl Div<Speed> for Distance[src]

type Output = Duration

The resulting type after applying the / operator.

impl Div<f64> for Distance[src]

type Output = Distance

The resulting type after applying the / operator.

impl Eq for Distance[src]

impl Mul<f64> for Distance[src]

type Output = Distance

The resulting type after applying the * operator.

impl Neg for Distance[src]

type Output = Distance

The resulting type after applying the - operator.

impl Ord for Distance[src]

impl PartialEq<Distance> for Distance[src]

impl PartialOrd<Distance> for Distance[src]

impl Serialize for Distance[src]

impl StructuralPartialEq for Distance[src]

impl Sub<Distance> for Distance[src]

type Output = Distance

The resulting type after applying the - operator.

impl SubAssign<Distance> for Distance[src]

impl Sum<Distance> for Distance[src]

Auto Trait Implementations

impl RefUnwindSafe for Distance[src]

impl Send for Distance[src]

impl Sync for Distance[src]

impl Unpin for Distance[src]

impl UnwindSafe for Distance[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.