Macro geo_types::line_string

source ·
macro_rules! line_string {
    () => { ... };
    (
        $(( $($tag:tt : $val:expr),* $(,)? )),*
        $(,)?
    ) => { ... };
    (
        $($coord:expr),*
        $(,)?
    ) => { ... };
}
Expand description

Creates a LineString containing the given coordinates.

line_string![Coord OR (x: <number>, y: <number>), …]

§Examples

Creating a LineString, supplying x/y values:

use geo_types::line_string;

let ls = line_string![
    (x: -21.95156, y: 64.1446),
    (x: -21.951, y: 64.14479),
    (x: -21.95044, y: 64.14527),
    (x: -21.951445, y: 64.145508),
];

assert_eq!(ls[1], geo_types::coord! {
    x: -21.951,
    y: 64.14479
});

Creating a LineString, supplying Coords:

use geo_types::line_string;

let coord1 = geo_types::coord! {
    x: -21.95156,
    y: 64.1446,
};
let coord2 = geo_types::coord! {
    x: -21.951,
    y: 64.14479,
};
let coord3 = geo_types::coord! {
    x: -21.95044,
    y: 64.14527,
};
let coord4 = geo_types::coord! {
    x: -21.951445,
    y: 64.145508,
};

let ls = line_string![coord1, coord2, coord3, coord4];

assert_eq!(
    ls[1],
    geo_types::coord! {
        x: -21.951,
        y: 64.14479
    }
);