This commit is contained in:
Nathan Sobo 2023-09-20 20:28:32 -06:00
parent 44608517c1
commit a8bb3dd9a3
8 changed files with 107 additions and 34 deletions

View file

@ -79,6 +79,15 @@ pub fn size<T: Clone + Debug>(width: T, height: T) -> Size<T> {
Size { width, height }
}
impl<T: Clone + Debug> Size<T> {
pub fn map<U: Clone + Debug, F: Fn(T) -> U>(&self, f: F) -> Size<U> {
Size {
width: f(self.width.clone()),
height: f(self.height.clone()),
}
}
}
impl From<Size<Option<Pixels>>> for Size<Option<f32>> {
fn from(val: Size<Option<Pixels>>) -> Self {
Size {