clipper_sys/
clipper.rs

1#![allow(non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#![allow(non_snake_case)]
4#![allow(dead_code)]
5#![allow(clippy::unreadable_literal)]
6#![allow(deref_nullptr)]
7
8#[cfg(all(not(feature = "update-bindings"), feature = "generate-bindings"))]
9include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
10
11#[cfg(any(feature = "update-bindings", not(feature = "generate-bindings")))]
12include!(concat!(
13    env!("CARGO_MANIFEST_DIR"),
14    "/generated/bindings.rs"
15));
16
17impl Path {
18    pub fn vertices(&self) -> &[[i64; 2]] {
19        unsafe { std::slice::from_raw_parts(self.vertices, self.vertices_count as usize) }
20    }
21}
22
23impl PartialEq for Path {
24    fn eq(&self, other: &Self) -> bool {
25        self.closed == other.closed && self.vertices() == other.vertices()
26    }
27}
28
29impl Eq for Path {}
30
31impl Polygon {
32    pub fn paths(&self) -> &[Path] {
33        unsafe { std::slice::from_raw_parts(self.paths, self.paths_count as usize) }
34    }
35}
36
37impl PartialEq for Polygon {
38    fn eq(&self, other: &Self) -> bool {
39        self.type_ == other.type_ && self.paths() == other.paths()
40    }
41}
42
43impl Eq for Polygon {}
44
45impl Polygons {
46    pub fn polygons(&self) -> &[Polygon] {
47        unsafe { std::slice::from_raw_parts(self.polygons, self.polygons_count as usize) }
48    }
49}
50
51impl PartialEq for Polygons {
52    fn eq(&self, other: &Self) -> bool {
53        self.polygons() == other.polygons()
54    }
55}
56
57impl Eq for Polygons {}