diff options
author | 2019-12-04 04:01:12 +0100 | |
---|---|---|
committer | 2019-12-04 04:01:12 +0100 | |
commit | 561c3641c6ac62333550c3017561fa7a18663f00 (patch) | |
tree | 3e0a502ab8e37679899002e4664a148fc474a087 /core | |
parent | 4293dcb2540144cc69a9f1370103bb780eca69f3 (diff) | |
parent | 6c145bbb239e87569bf4aa797ea7f8d34e25cf62 (diff) | |
download | iced-561c3641c6ac62333550c3017561fa7a18663f00.tar.gz iced-561c3641c6ac62333550c3017561fa7a18663f00.tar.bz2 iced-561c3641c6ac62333550c3017561fa7a18663f00.zip |
Merge branch 'master' into feature/image-from-bytes
Diffstat (limited to 'core')
-rw-r--r-- | core/src/length.rs | 6 | ||||
-rw-r--r-- | core/src/point.rs | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/core/src/length.rs b/core/src/length.rs index 63ba6207..10873e89 100644 --- a/core/src/length.rs +++ b/core/src/length.rs @@ -27,3 +27,9 @@ impl Length { } } } + +impl From<u16> for Length { + fn from(units: u16) -> Self { + Length::Units(units) + } +} 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<Vector> for Point { type Output = Self; |