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 besize_t:1
- an unsigned 32-bit
intfor precision (5 for Google Polylines, 6 for OSRM and Valhalla Polylines)
A decoding failure will return one of the following:
- a
char*beginning with "Longitude error:" if invalid longitudes are passed - a
char*beginning with "Latitude error:" if invalid latitudes are passed
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