From 62725a76ef4f567c16d569fb5da5ffcc0481cb2a Mon Sep 17 00:00:00 2001 From: Nikolai Vazquez Date: Fri, 29 Nov 2019 20:52:26 -0500 Subject: Add `From` impls for `Length`, `Point`, and `Size` --- core/src/point.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'core/src/point.rs') diff --git a/core/src/point.rs b/core/src/point.rs index 183998dd..47c8b142 100644 --- a/core/src/point.rs +++ b/core/src/point.rs @@ -19,6 +19,18 @@ impl Point { } } +impl From<[f32; 2]> for Point { + fn from([x, y]: [f32; 2]) -> Self { + Point { x, y } + } +} + +impl From<[u16; 2]> for Point { + fn from([x, y]: [u16; 2]) -> Self { + Point::new(x.into(), y.into()) + } +} + impl std::ops::Add for Point { type Output = Self; -- cgit