diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-11-28 20:38:21 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-11-28 20:38:21 +0100 |
| commit | b4efae08834a3a950387f01aebaa9e832acd9423 (patch) | |
| tree | bf311243f625a6da5660ff99ebc2764079f502cf /src/size.rs | |
| parent | 17082389ae90438682978c825ec620b544d73b65 (diff) | |
Remove bad tests and tweak numbers for better debugging 🧪
Diffstat (limited to 'src/size.rs')
| -rw-r--r-- | src/size.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/size.rs b/src/size.rs index fac31625..50b3ace5 100644 --- a/src/size.rs +++ b/src/size.rs @@ -116,6 +116,12 @@ impl Size2D { Size2D::default() } + /// Create a 2D-size with `x` and `y` set to the same value `s`. + #[inline] + pub fn with_all(s: Size) -> Size2D { + Size2D { x: s, y: s } + } + /// Create a new 2D-size with `x` set to a value and `y` zero. #[inline] pub fn with_x(x: Size) -> Size2D { @@ -179,6 +185,12 @@ impl SizeBox { pub fn zero() -> SizeBox { SizeBox::default() } + + /// Create a box with all four fields set to the same value `s`. + #[inline] + pub fn with_all(s: Size) -> SizeBox { + SizeBox { left: s, top: s, right: s, bottom: s } + } } /// The maximum of two sizes. |
