1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

use math::{
margin_rectangle,
relative_rectangle,
Scalar,
};
use types::Rectangle;
pub trait Rectangled: Sized {
fn margin(self, m: Scalar) -> Self;
#[inline(always)]
fn expand(self, m: Scalar) -> Self {
self.margin(-m)
}
fn rel(self, x: Scalar, y: Scalar) -> Self;
}
impl Rectangled for Rectangle {
#[inline(always)]
fn margin(self, m: Scalar) -> Self {
margin_rectangle(self, m)
}
#[inline(always)]
fn rel(self, x: Scalar, y: Scalar) -> Self {
relative_rectangle(self, [x, y])
}
}