Skip to main content

geometry_box/
size_box.rs

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