Add From impls for Length, Point, and Size

This commit is contained in:
Nikolai Vazquez 2019-11-29 20:52:26 -05:00
parent 811d8b90d7
commit 62725a76ef
3 changed files with 30 additions and 0 deletions

View file

@ -37,3 +37,15 @@ impl Size {
}
}
}
impl From<[f32; 2]> for Size {
fn from([width, height]: [f32; 2]) -> Self {
Size { width, height }
}
}
impl From<[u16; 2]> for Size {
fn from([width, height]: [u16; 2]) -> Self {
Size::new(width.into(), height.into())
}
}