vec2
add Into<(T, T)>
bendn 2023-10-15
parent ad08944 · commit 6de7fed
-rw-r--r--Cargo.toml2
-rw-r--r--src/from.rs7
2 files changed, 8 insertions, 1 deletions
diff --git a/Cargo.toml b/Cargo.toml
index b797b77..482b855 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "vecto"
-version = "0.1.0"
+version = "0.1.1"
edition = "2021"
license = "MIT"
description = "vector2"
diff --git a/src/from.rs b/src/from.rs
index 000d243..b6302cf 100644
--- a/src/from.rs
+++ b/src/from.rs
@@ -30,3 +30,10 @@ impl<T: Copy> TryFrom<&[T]> for Vector2<T> {
.ok_or(())
}
}
+
+impl<T> From<Vector2<T>> for (T, T) {
+ /// Tuplifys the vec, (x, y).
+ fn from(value: Vector2<T>) -> Self {
+ (value.x, value.y)
+ }
+}