From 4eeda83ba4bdb5e20c765a46e43227f4f9b39b69 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 24 Feb 2024 06:02:11 -0600 Subject: add some more convenience functions --- azalea-core/src/position.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'azalea-core/src') diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs index e9864035..369607c5 100755 --- a/azalea-core/src/position.rs +++ b/azalea-core/src/position.rs @@ -186,6 +186,25 @@ macro_rules! vec3_impl { } } } + + impl From<($type, $type, $type)> for $name { + #[inline] + fn from(pos: ($type, $type, $type)) -> Self { + Self::new(pos.0, pos.1, pos.2) + } + } + impl From<&($type, $type, $type)> for $name { + #[inline] + fn from(pos: &($type, $type, $type)) -> Self { + Self::new(pos.0, pos.1, pos.2) + } + } + impl From<$name> for ($type, $type, $type) { + #[inline] + fn from(pos: $name) -> Self { + (pos.x, pos.y, pos.z) + } + } }; } -- cgit v1.2.3