Add a from Dir2 impl for Vec2 (#12594)

# Objective

Allow converting from `Dir2` to `Vec2` in generic code. Fixes #12529.

## Solution

Added a `From<Dir2>` impl for `Vec2`.
This commit is contained in:
Brezak 2024-03-20 15:21:50 +01:00 committed by GitHub
parent 4d0d070059
commit ed44eb3913
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -151,6 +151,12 @@ impl TryFrom<Vec2> for Dir2 {
} }
} }
impl From<Dir2> for Vec2 {
fn from(value: Dir2) -> Self {
value.as_vec2()
}
}
impl std::ops::Deref for Dir2 { impl std::ops::Deref for Dir2 {
type Target = Vec2; type Target = Vec2;
fn deref(&self) -> &Self::Target { fn deref(&self) -> &Self::Target {