summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Azorlogh <bott.alix@gmail.com>2020-10-08 09:54:22 +0200
committerLibravatar Azorlogh <bott.alix@gmail.com>2020-10-08 09:54:22 +0200
commite6bcb7211f5e326aac4b584b44d3afff6de595ee (patch)
treeb9479a37dfde71b8994522b434af35c6424d6273 /core
parent2e0ba65a201da0948e609cf2ddfa3d7a9eea64c7 (diff)
downloadiced-e6bcb7211f5e326aac4b584b44d3afff6de595ee.tar.gz
iced-e6bcb7211f5e326aac4b584b44d3afff6de595ee.tar.bz2
iced-e6bcb7211f5e326aac4b584b44d3afff6de595ee.zip
add From<Point> and From<Size> for [f32; 2]
Diffstat (limited to 'core')
-rw-r--r--core/src/point.rs6
-rw-r--r--core/src/size.rs6
2 files changed, 12 insertions, 0 deletions
diff --git a/core/src/point.rs b/core/src/point.rs
index 3714aa2f..7d93538f 100644
--- a/core/src/point.rs
+++ b/core/src/point.rs
@@ -46,6 +46,12 @@ impl From<[u16; 2]> for Point {
}
}
+impl From<Point> for [f32; 2] {
+ fn from(point: Point) -> [f32; 2] {
+ [point.x, point.y]
+ }
+}
+
impl std::ops::Add<Vector> for Point {
type Output = Self;
diff --git a/core/src/size.rs b/core/src/size.rs
index aceb5311..7c481935 100644
--- a/core/src/size.rs
+++ b/core/src/size.rs
@@ -56,3 +56,9 @@ impl From<[u16; 2]> for Size {
Size::new(width.into(), height.into())
}
}
+
+impl From<Size> for [f32; 2] {
+ fn from(size: Size) -> [f32; 2] {
+ [size.width, size.height]
+ }
+}