diff options
author | 2019-11-30 17:01:01 +0100 | |
---|---|---|
committer | 2019-11-30 17:01:01 +0100 | |
commit | e404f5098a4e053f52e75175b6cd677e60d27517 (patch) | |
tree | f9505a4e2bc7f4f0038252caa733ba33a4e147cc /native/src | |
parent | 811d8b90d71c26100f0933217f5474e090fbf17c (diff) | |
parent | 62725a76ef4f567c16d569fb5da5ffcc0481cb2a (diff) | |
download | iced-e404f5098a4e053f52e75175b6cd677e60d27517.tar.gz iced-e404f5098a4e053f52e75175b6cd677e60d27517.tar.bz2 iced-e404f5098a4e053f52e75175b6cd677e60d27517.zip |
Merge pull request #92 from nvzqz/type-conversions
Add `From` impls for `Length`, `Point`, and `Size`
Diffstat (limited to 'native/src')
-rw-r--r-- | native/src/size.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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()) + } +} |