leftwm_core/models/
margins.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
4pub struct Margins {
5 pub top: u32,
6 pub right: u32,
7 pub bottom: u32,
8 pub left: u32,
9}
10
11impl Margins {
12 pub const fn new(size: u32) -> Self {
13 Self {
14 top: size,
15 right: size,
16 bottom: size,
17 left: size,
18 }
19 }
20
21 pub const fn new_from_pair(top_and_bottom: u32, left_and_right: u32) -> Self {
22 Self {
23 top: top_and_bottom,
24 right: left_and_right,
25 bottom: top_and_bottom,
26 left: left_and_right,
27 }
28 }
29
30 pub const fn new_from_triple(top: u32, left_and_right: u32, bottom: u32) -> Self {
31 Self {
32 top,
33 right: left_and_right,
34 bottom,
35 left: left_and_right,
36 }
37 }
38}