Add Padding widget

This commit is contained in:
Joscha 2023-02-16 14:30:12 +01:00
parent 964f3bf011
commit dbafc40700
3 changed files with 133 additions and 0 deletions

View file

@ -16,6 +16,20 @@ impl Size {
pub const fn new(width: u16, height: u16) -> Self {
Self { width, height }
}
pub const fn saturating_add(self, rhs: Self) -> Self {
Self::new(
self.width.saturating_add(rhs.width),
self.height.saturating_add(rhs.height),
)
}
pub const fn saturating_sub(self, rhs: Self) -> Self {
Self::new(
self.width.saturating_sub(rhs.width),
self.height.saturating_sub(rhs.height),
)
}
}
impl Add for Size {