libh3_sys/
bindings.rs

1/* automatically generated by rust-bindgen */
2
3#[doc = " @brief the H3Index fits within a 64-bit unsigned integer"]
4pub type H3Index = u64;
5
6#[doc = " @struct GeoCoord"]
7#[doc = "@brief latitude/longitude in radians"]
8#[repr(C)]
9#[derive(Debug, Copy, Clone)]
10pub struct GeoCoord {
11    #[doc = "< latitude in radians"]
12    pub lat: f64,
13    #[doc = "< longitude in radians"]
14    pub lon: f64,
15}
16#[test]
17fn bindgen_test_layout_GeoCoord() {
18    assert_eq!(
19        ::std::mem::size_of::<GeoCoord>(),
20        16usize,
21        concat!("Size of: ", stringify!(GeoCoord))
22    );
23    assert_eq!(
24        ::std::mem::align_of::<GeoCoord>(),
25        8usize,
26        concat!("Alignment of ", stringify!(GeoCoord))
27    );
28    assert_eq!(
29        unsafe { &(*(::std::ptr::null::<GeoCoord>())).lat as *const _ as usize },
30        0usize,
31        concat!(
32            "Offset of field: ",
33            stringify!(GeoCoord),
34            "::",
35            stringify!(lat)
36        )
37    );
38    assert_eq!(
39        unsafe { &(*(::std::ptr::null::<GeoCoord>())).lon as *const _ as usize },
40        8usize,
41        concat!(
42            "Offset of field: ",
43            stringify!(GeoCoord),
44            "::",
45            stringify!(lon)
46        )
47    );
48}
49#[doc = " @struct GeoBoundary"]
50#[doc = "@brief cell boundary in latitude/longitude"]
51#[repr(C)]
52#[derive(Debug, Copy, Clone)]
53pub struct GeoBoundary {
54    #[doc = "< number of vertices"]
55    pub numVerts: ::std::os::raw::c_int,
56    #[doc = "< vertices in ccw order"]
57    pub verts: [GeoCoord; 10usize],
58}
59#[test]
60fn bindgen_test_layout_GeoBoundary() {
61    assert_eq!(
62        ::std::mem::size_of::<GeoBoundary>(),
63        168usize,
64        concat!("Size of: ", stringify!(GeoBoundary))
65    );
66    assert_eq!(
67        ::std::mem::align_of::<GeoBoundary>(),
68        8usize,
69        concat!("Alignment of ", stringify!(GeoBoundary))
70    );
71    assert_eq!(
72        unsafe { &(*(::std::ptr::null::<GeoBoundary>())).numVerts as *const _ as usize },
73        0usize,
74        concat!(
75            "Offset of field: ",
76            stringify!(GeoBoundary),
77            "::",
78            stringify!(numVerts)
79        )
80    );
81    assert_eq!(
82        unsafe { &(*(::std::ptr::null::<GeoBoundary>())).verts as *const _ as usize },
83        8usize,
84        concat!(
85            "Offset of field: ",
86            stringify!(GeoBoundary),
87            "::",
88            stringify!(verts)
89        )
90    );
91}
92#[doc = " @struct Geofence"]
93#[doc = "  @brief similar to GeoBoundary, but requires more alloc work"]
94#[repr(C)]
95#[derive(Debug, Copy, Clone)]
96pub struct Geofence {
97    pub numVerts: ::std::os::raw::c_int,
98    pub verts: *const GeoCoord,
99}
100#[test]
101fn bindgen_test_layout_Geofence() {
102    assert_eq!(
103        ::std::mem::size_of::<Geofence>(),
104        16usize,
105        concat!("Size of: ", stringify!(Geofence))
106    );
107    assert_eq!(
108        ::std::mem::align_of::<Geofence>(),
109        8usize,
110        concat!("Alignment of ", stringify!(Geofence))
111    );
112    assert_eq!(
113        unsafe { &(*(::std::ptr::null::<Geofence>())).numVerts as *const _ as usize },
114        0usize,
115        concat!(
116            "Offset of field: ",
117            stringify!(Geofence),
118            "::",
119            stringify!(numVerts)
120        )
121    );
122    assert_eq!(
123        unsafe { &(*(::std::ptr::null::<Geofence>())).verts as *const _ as usize },
124        8usize,
125        concat!(
126            "Offset of field: ",
127            stringify!(Geofence),
128            "::",
129            stringify!(verts)
130        )
131    );
132}
133#[doc = " @struct GeoPolygon"]
134#[doc = "  @brief Simplified core of GeoJSON Polygon coordinates definition"]
135#[repr(C)]
136#[derive(Debug, Copy, Clone)]
137pub struct GeoPolygon {
138    #[doc = "< exterior boundary of the polygon"]
139    pub geofence: Geofence,
140    #[doc = "< number of elements in the array pointed to by holes"]
141    pub numHoles: ::std::os::raw::c_int,
142    #[doc = "< interior boundaries (holes) in the polygon"]
143    pub holes: *const Geofence,
144}
145#[test]
146fn bindgen_test_layout_GeoPolygon() {
147    assert_eq!(
148        ::std::mem::size_of::<GeoPolygon>(),
149        32usize,
150        concat!("Size of: ", stringify!(GeoPolygon))
151    );
152    assert_eq!(
153        ::std::mem::align_of::<GeoPolygon>(),
154        8usize,
155        concat!("Alignment of ", stringify!(GeoPolygon))
156    );
157    assert_eq!(
158        unsafe { &(*(::std::ptr::null::<GeoPolygon>())).geofence as *const _ as usize },
159        0usize,
160        concat!(
161            "Offset of field: ",
162            stringify!(GeoPolygon),
163            "::",
164            stringify!(geofence)
165        )
166    );
167    assert_eq!(
168        unsafe { &(*(::std::ptr::null::<GeoPolygon>())).numHoles as *const _ as usize },
169        16usize,
170        concat!(
171            "Offset of field: ",
172            stringify!(GeoPolygon),
173            "::",
174            stringify!(numHoles)
175        )
176    );
177    assert_eq!(
178        unsafe { &(*(::std::ptr::null::<GeoPolygon>())).holes as *const _ as usize },
179        24usize,
180        concat!(
181            "Offset of field: ",
182            stringify!(GeoPolygon),
183            "::",
184            stringify!(holes)
185        )
186    );
187}
188#[repr(C)]
189#[derive(Debug, Copy, Clone)]
190pub struct LinkedGeoCoord {
191    pub vertex: GeoCoord,
192    pub next: *mut LinkedGeoCoord,
193}
194#[test]
195fn bindgen_test_layout_LinkedGeoCoord() {
196    assert_eq!(
197        ::std::mem::size_of::<LinkedGeoCoord>(),
198        24usize,
199        concat!("Size of: ", stringify!(LinkedGeoCoord))
200    );
201    assert_eq!(
202        ::std::mem::align_of::<LinkedGeoCoord>(),
203        8usize,
204        concat!("Alignment of ", stringify!(LinkedGeoCoord))
205    );
206    assert_eq!(
207        unsafe { &(*(::std::ptr::null::<LinkedGeoCoord>())).vertex as *const _ as usize },
208        0usize,
209        concat!(
210            "Offset of field: ",
211            stringify!(LinkedGeoCoord),
212            "::",
213            stringify!(vertex)
214        )
215    );
216    assert_eq!(
217        unsafe { &(*(::std::ptr::null::<LinkedGeoCoord>())).next as *const _ as usize },
218        16usize,
219        concat!(
220            "Offset of field: ",
221            stringify!(LinkedGeoCoord),
222            "::",
223            stringify!(next)
224        )
225    );
226}
227#[repr(C)]
228#[derive(Debug, Copy, Clone)]
229pub struct LinkedGeoLoop {
230    pub first: *mut LinkedGeoCoord,
231    pub last: *mut LinkedGeoCoord,
232    pub next: *mut LinkedGeoLoop,
233}
234#[test]
235fn bindgen_test_layout_LinkedGeoLoop() {
236    assert_eq!(
237        ::std::mem::size_of::<LinkedGeoLoop>(),
238        24usize,
239        concat!("Size of: ", stringify!(LinkedGeoLoop))
240    );
241    assert_eq!(
242        ::std::mem::align_of::<LinkedGeoLoop>(),
243        8usize,
244        concat!("Alignment of ", stringify!(LinkedGeoLoop))
245    );
246    assert_eq!(
247        unsafe { &(*(::std::ptr::null::<LinkedGeoLoop>())).first as *const _ as usize },
248        0usize,
249        concat!(
250            "Offset of field: ",
251            stringify!(LinkedGeoLoop),
252            "::",
253            stringify!(first)
254        )
255    );
256    assert_eq!(
257        unsafe { &(*(::std::ptr::null::<LinkedGeoLoop>())).last as *const _ as usize },
258        8usize,
259        concat!(
260            "Offset of field: ",
261            stringify!(LinkedGeoLoop),
262            "::",
263            stringify!(last)
264        )
265    );
266    assert_eq!(
267        unsafe { &(*(::std::ptr::null::<LinkedGeoLoop>())).next as *const _ as usize },
268        16usize,
269        concat!(
270            "Offset of field: ",
271            stringify!(LinkedGeoLoop),
272            "::",
273            stringify!(next)
274        )
275    );
276}
277#[repr(C)]
278#[derive(Debug, Copy, Clone)]
279pub struct LinkedGeoPolygon {
280    pub first: *mut LinkedGeoLoop,
281    pub last: *mut LinkedGeoLoop,
282    pub next: *mut LinkedGeoPolygon,
283}
284#[test]
285fn bindgen_test_layout_LinkedGeoPolygon() {
286    assert_eq!(
287        ::std::mem::size_of::<LinkedGeoPolygon>(),
288        24usize,
289        concat!("Size of: ", stringify!(LinkedGeoPolygon))
290    );
291    assert_eq!(
292        ::std::mem::align_of::<LinkedGeoPolygon>(),
293        8usize,
294        concat!("Alignment of ", stringify!(LinkedGeoPolygon))
295    );
296    assert_eq!(
297        unsafe { &(*(::std::ptr::null::<LinkedGeoPolygon>())).first as *const _ as usize },
298        0usize,
299        concat!(
300            "Offset of field: ",
301            stringify!(LinkedGeoPolygon),
302            "::",
303            stringify!(first)
304        )
305    );
306    assert_eq!(
307        unsafe { &(*(::std::ptr::null::<LinkedGeoPolygon>())).last as *const _ as usize },
308        8usize,
309        concat!(
310            "Offset of field: ",
311            stringify!(LinkedGeoPolygon),
312            "::",
313            stringify!(last)
314        )
315    );
316    assert_eq!(
317        unsafe { &(*(::std::ptr::null::<LinkedGeoPolygon>())).next as *const _ as usize },
318        16usize,
319        concat!(
320            "Offset of field: ",
321            stringify!(LinkedGeoPolygon),
322            "::",
323            stringify!(next)
324        )
325    );
326}
327#[doc = " @struct CoordIJ"]
328#[doc = " @brief IJ hexagon coordinates"]
329#[doc = ""]
330#[doc = " Each axis is spaced 120 degrees apart."]
331#[repr(C)]
332#[derive(Debug, Copy, Clone)]
333pub struct CoordIJ {
334    #[doc = "< i component"]
335    pub i: ::std::os::raw::c_int,
336    #[doc = "< j component"]
337    pub j: ::std::os::raw::c_int,
338}
339#[test]
340fn bindgen_test_layout_CoordIJ() {
341    assert_eq!(
342        ::std::mem::size_of::<CoordIJ>(),
343        8usize,
344        concat!("Size of: ", stringify!(CoordIJ))
345    );
346    assert_eq!(
347        ::std::mem::align_of::<CoordIJ>(),
348        4usize,
349        concat!("Alignment of ", stringify!(CoordIJ))
350    );
351    assert_eq!(
352        unsafe { &(*(::std::ptr::null::<CoordIJ>())).i as *const _ as usize },
353        0usize,
354        concat!(
355            "Offset of field: ",
356            stringify!(CoordIJ),
357            "::",
358            stringify!(i)
359        )
360    );
361    assert_eq!(
362        unsafe { &(*(::std::ptr::null::<CoordIJ>())).j as *const _ as usize },
363        4usize,
364        concat!(
365            "Offset of field: ",
366            stringify!(CoordIJ),
367            "::",
368            stringify!(j)
369        )
370    );
371}
372extern "C" {
373    pub fn geoToH3(g: *const GeoCoord, res: ::std::os::raw::c_int) -> H3Index;
374}
375extern "C" {
376    pub fn h3ToGeo(h3: H3Index, g: *mut GeoCoord);
377}
378extern "C" {
379    pub fn h3ToGeoBoundary(h3: H3Index, gp: *mut GeoBoundary);
380}
381extern "C" {
382    pub fn maxKringSize(k: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
383}
384extern "C" {
385    pub fn hexRange(
386        origin: H3Index,
387        k: ::std::os::raw::c_int,
388        out: *mut H3Index,
389    ) -> ::std::os::raw::c_int;
390}
391extern "C" {
392    pub fn hexRangeDistances(
393        origin: H3Index,
394        k: ::std::os::raw::c_int,
395        out: *mut H3Index,
396        distances: *mut ::std::os::raw::c_int,
397    ) -> ::std::os::raw::c_int;
398}
399extern "C" {
400    pub fn hexRanges(
401        h3Set: *mut H3Index,
402        length: ::std::os::raw::c_int,
403        k: ::std::os::raw::c_int,
404        out: *mut H3Index,
405    ) -> ::std::os::raw::c_int;
406}
407extern "C" {
408    pub fn kRing(origin: H3Index, k: ::std::os::raw::c_int, out: *mut H3Index);
409}
410extern "C" {
411    pub fn kRingDistances(
412        origin: H3Index,
413        k: ::std::os::raw::c_int,
414        out: *mut H3Index,
415        distances: *mut ::std::os::raw::c_int,
416    );
417}
418extern "C" {
419    pub fn hexRing(
420        origin: H3Index,
421        k: ::std::os::raw::c_int,
422        out: *mut H3Index,
423    ) -> ::std::os::raw::c_int;
424}
425extern "C" {
426    pub fn maxPolyfillSize(
427        geoPolygon: *const GeoPolygon,
428        res: ::std::os::raw::c_int,
429    ) -> ::std::os::raw::c_int;
430}
431extern "C" {
432    pub fn polyfill(geoPolygon: *const GeoPolygon, res: ::std::os::raw::c_int, out: *mut H3Index);
433}
434extern "C" {
435    pub fn h3SetToLinkedGeo(
436        h3Set: *const H3Index,
437        numHexes: ::std::os::raw::c_int,
438        out: *mut LinkedGeoPolygon,
439    );
440}
441extern "C" {
442    pub fn destroyLinkedPolygon(polygon: *mut LinkedGeoPolygon);
443}
444extern "C" {
445    pub fn degsToRads(degrees: f64) -> f64;
446}
447extern "C" {
448    pub fn radsToDegs(radians: f64) -> f64;
449}
450extern "C" {
451    pub fn hexAreaKm2(res: ::std::os::raw::c_int) -> f64;
452}
453extern "C" {
454    pub fn hexAreaM2(res: ::std::os::raw::c_int) -> f64;
455}
456extern "C" {
457    pub fn edgeLengthKm(res: ::std::os::raw::c_int) -> f64;
458}
459extern "C" {
460    pub fn edgeLengthM(res: ::std::os::raw::c_int) -> f64;
461}
462extern "C" {
463    pub fn numHexagons(res: ::std::os::raw::c_int) -> i64;
464}
465extern "C" {
466    pub fn res0IndexCount() -> ::std::os::raw::c_int;
467}
468extern "C" {
469    pub fn getRes0Indexes(out: *mut H3Index);
470}
471extern "C" {
472    pub fn pentagonIndexCount() -> ::std::os::raw::c_int;
473}
474extern "C" {
475    pub fn getPentagonIndexes(res: ::std::os::raw::c_int, out: *mut H3Index);
476}
477extern "C" {
478    pub fn h3GetResolution(h: H3Index) -> ::std::os::raw::c_int;
479}
480extern "C" {
481    pub fn h3GetBaseCell(h: H3Index) -> ::std::os::raw::c_int;
482}
483extern "C" {
484    pub fn stringToH3(str: *const ::std::os::raw::c_char) -> H3Index;
485}
486extern "C" {
487    pub fn h3ToString(h: H3Index, str: *mut ::std::os::raw::c_char, sz: usize);
488}
489extern "C" {
490    pub fn h3IsValid(h: H3Index) -> ::std::os::raw::c_int;
491}
492extern "C" {
493    pub fn h3ToParent(h: H3Index, parentRes: ::std::os::raw::c_int) -> H3Index;
494}
495extern "C" {
496    pub fn maxH3ToChildrenSize(
497        h: H3Index,
498        childRes: ::std::os::raw::c_int,
499    ) -> ::std::os::raw::c_int;
500}
501extern "C" {
502    pub fn h3ToChildren(h: H3Index, childRes: ::std::os::raw::c_int, children: *mut H3Index);
503}
504extern "C" {
505    pub fn h3ToCenterChild(h: H3Index, childRes: ::std::os::raw::c_int) -> H3Index;
506}
507extern "C" {
508    pub fn compact(
509        h3Set: *const H3Index,
510        compactedSet: *mut H3Index,
511        numHexes: ::std::os::raw::c_int,
512    ) -> ::std::os::raw::c_int;
513}
514extern "C" {
515    pub fn maxUncompactSize(
516        compactedSet: *const H3Index,
517        numHexes: ::std::os::raw::c_int,
518        res: ::std::os::raw::c_int,
519    ) -> ::std::os::raw::c_int;
520}
521extern "C" {
522    pub fn uncompact(
523        compactedSet: *const H3Index,
524        numHexes: ::std::os::raw::c_int,
525        h3Set: *mut H3Index,
526        maxHexes: ::std::os::raw::c_int,
527        res: ::std::os::raw::c_int,
528    ) -> ::std::os::raw::c_int;
529}
530extern "C" {
531    pub fn h3IsResClassIII(h: H3Index) -> ::std::os::raw::c_int;
532}
533extern "C" {
534    pub fn h3IsPentagon(h: H3Index) -> ::std::os::raw::c_int;
535}
536extern "C" {
537    pub fn maxFaceCount(h3: H3Index) -> ::std::os::raw::c_int;
538}
539extern "C" {
540    pub fn h3GetFaces(h3: H3Index, out: *mut ::std::os::raw::c_int);
541}
542extern "C" {
543    pub fn h3IndexesAreNeighbors(origin: H3Index, destination: H3Index) -> ::std::os::raw::c_int;
544}
545extern "C" {
546    pub fn getH3UnidirectionalEdge(origin: H3Index, destination: H3Index) -> H3Index;
547}
548extern "C" {
549    pub fn h3UnidirectionalEdgeIsValid(edge: H3Index) -> ::std::os::raw::c_int;
550}
551extern "C" {
552    pub fn getOriginH3IndexFromUnidirectionalEdge(edge: H3Index) -> H3Index;
553}
554extern "C" {
555    pub fn getDestinationH3IndexFromUnidirectionalEdge(edge: H3Index) -> H3Index;
556}
557extern "C" {
558    pub fn getH3IndexesFromUnidirectionalEdge(edge: H3Index, originDestination: *mut H3Index);
559}
560extern "C" {
561    pub fn getH3UnidirectionalEdgesFromHexagon(origin: H3Index, edges: *mut H3Index);
562}
563extern "C" {
564    pub fn getH3UnidirectionalEdgeBoundary(edge: H3Index, gb: *mut GeoBoundary);
565}
566extern "C" {
567    pub fn h3Distance(origin: H3Index, h3: H3Index) -> ::std::os::raw::c_int;
568}
569extern "C" {
570    pub fn h3LineSize(start: H3Index, end: H3Index) -> ::std::os::raw::c_int;
571}
572extern "C" {
573    pub fn h3Line(start: H3Index, end: H3Index, out: *mut H3Index) -> ::std::os::raw::c_int;
574}
575extern "C" {
576    pub fn experimentalH3ToLocalIj(
577        origin: H3Index,
578        h3: H3Index,
579        out: *mut CoordIJ,
580    ) -> ::std::os::raw::c_int;
581}
582extern "C" {
583    pub fn experimentalLocalIjToH3(
584        origin: H3Index,
585        ij: *const CoordIJ,
586        out: *mut H3Index,
587    ) -> ::std::os::raw::c_int;
588}