Function polyline_ffi::encode_coordinates_ffi [] [src]

pub extern fn encode_coordinates_ffi(coords: Array, precision: uint32_t) -> *mut c_char

Convert an array of coordinates into a Polyline

Callers must pass two arguments:

  • a Struct with two fields:
    • data, a void pointer to an array of floating-point lat, lon coordinates: [[1.0, 2.0]]
    • len, the length of the array being passed. Its type must be size_t: 1
  • an unsigned 32-bit int for precision (5 for Google Polylines, 6 for OSRM and Valhalla Polylines)

A decoding failure will always return a string: "Couldn't decode Polyline"

Implementations calling this function must call drop_cstring with the returned c_char pointer, in order to free the memory it allocates.

Safety

This function is unsafe because it accesses a raw pointer which could contain arbitrary data