Skip to main content

geometry_box/
point2_box.rs

1#[derive(Debug, Copy, Clone, Default)]
2#[repr(C)]
3pub struct PointBox<T>
4where
5    T: From<u8> + Default + Copy,
6{
7    pub x: T,
8    pub y: T,
9}
10
11impl<T> PointBox<T>
12where
13    T: From<u8> + Default + Copy,
14{
15    pub fn be_zero(&mut self) {
16        self.x = 0u8.into();
17        self.y = 0u8.into();
18    }
19
20    pub fn new(x: T, y: T) -> Self {
21        PointBox::<T> { x, y }
22    }
23}