Struct geom::Distance [−][src]
pub struct Distance(f64);
A distance, in meters. Can be negative.
Implementations
impl Distance
[src]
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 feet(value: f64) -> Distance
[src]
Creates a distance in feet.
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 Distance
s.
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. Rounds to 1 decimal place for both small (feet and meters) and large (miles and kilometers) units.
pub fn safe_percent(self, other: Distance) -> f64
[src]
Calculates a percentage, usually in [0.0, 1.0], of self / other. If the denominator is zero, returns 0%.
pub fn round_up_for_axis(self) -> Distance
[src]
Rounds this distance up to a higher, more “even” value to use for buckets along a plot’s axis. Always rounds for imperial units (feet).
Trait Implementations
impl<'de> Deserialize<'de> for Distance
[src]
impl<'de> Deserialize<'de> for Distance
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialOrd<Distance> for Distance
[src]
impl PartialOrd<Distance> for Distance
[src]impl Copy for Distance
[src]
impl Eq for Distance
[src]
impl StructuralPartialEq for Distance
[src]
Auto Trait Implementations
impl RefUnwindSafe for Distance
impl Send for Distance
impl Sync for Distance
impl Unpin for Distance
impl UnwindSafe for Distance
Blanket Implementations
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,