LengthMeasurable

Trait LengthMeasurable 

Source
pub trait LengthMeasurable<F: CoordFloat> {
    // Required method
    fn length(&self, metric_space: &impl Distance<F, Point<F>, Point<F>>) -> F;
}
Expand description

Something which can be measured by a metric space, such as a Line, LineString, or MultiLineString.

It’s typically more convenient to use the Length trait instead of this trait directly.

§Examples

use geo::algorithm::line_measures::{LengthMeasurable, Euclidean, Haversine};

let line_string = geo::wkt!(LINESTRING(
    0.0 0.0,
    3.0 4.0,
    3.0 5.0
));
assert_eq!(line_string.length(&Euclidean), 6.);

let line_string_lon_lat = geo::wkt!(LINESTRING (
    -47.9292 -15.7801f64,
    -58.4173 -34.6118,
    -70.6483 -33.4489
));
assert_eq!(line_string_lon_lat.length(&Haversine).round(), 3_474_956.0);

Required Methods§

Source

fn length(&self, metric_space: &impl Distance<F, Point<F>, Point<F>>) -> F

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§