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` --- native/src/size.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'native') diff --git a/native/src/size.rs b/native/src/size.rs index 30e2a57e..389b3247 100644 --- a/native/src/size.rs +++ b/native/src/size.rs @@ -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()) + } +} -- cgit