[][src]Macro geo_types::line_string

macro_rules! line_string {
    () => { ... };
    (
        $((x: $x:expr, y: $y:expr)),*
        $(,)?
    ) => { ... };
    (
        $($coord:expr),*
        $(,)?
    ) => { ... };
}

Creates a LineString containing the given coordinates.

line_string![«Coordinate|(x,y)», …]

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::Coordinate {
    x: -21.951,
    y: 64.14479
});

Creating a LineString, supplying Coordinates:

use geo_types::line_string;

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

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

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