summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-10-08 15:50:09 +0200
committerLibravatar GitHub <noreply@github.com>2020-10-08 15:50:09 +0200
commitbe61d84caed47c066d4c405aba465a026c2898e6 (patch)
treeb9479a37dfde71b8994522b434af35c6424d6273 /core
parent2e0ba65a201da0948e609cf2ddfa3d7a9eea64c7 (diff)
parente6bcb7211f5e326aac4b584b44d3afff6de595ee (diff)
downloadiced-be61d84caed47c066d4c405aba465a026c2898e6.tar.gz
iced-be61d84caed47c066d4c405aba465a026c2898e6.tar.bz2
iced-be61d84caed47c066d4c405aba465a026c2898e6.zip
Merge pull request #558 from Azorlogh/master
Adds From<Point> and From<Size> for [f32; 2]
Diffstat (limited to '')
-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]
+ }
+}