microcad_core/geo2d/
size.rs1use crate::Scalar;
5
6#[derive(Clone, Default, Debug)]
8pub struct Size2 {
9 pub width: Scalar,
11 pub height: Scalar,
13}
14
15impl Size2 {
16 pub const A4: Size2 = Size2 {
18 width: 210.0,
19 height: 297.0,
20 };
21
22 pub fn transposed(self) -> Self {
24 Self {
25 width: self.height,
26 height: self.width,
27 }
28 }
29}
30
31impl std::fmt::Display for Size2 {
32 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33 write!(f, "Size2({} mm x {} mm)", self.width, self.height)
34 }
35}