use crate::Vector2; impl From<(T, T)> for Vector2 { fn from((x, y): (T, T)) -> Self { Self::new(x, y) } } impl From for Vector2 { /// Splats the value. fn from(value: T) -> Self { Self::splat(value) } } impl From<[T; 2]> for Vector2 { fn from([x, y]: [T; 2]) -> Self { Self::new(x, y) } } impl TryFrom<&[T]> for Vector2 { type Error = (); /// If the slice len is 2, constructs a new vec. fn try_from(value: &[T]) -> Result { value .len() .eq(&2) .then(|| Self::new(value[0], value[1])) .ok_or(()) } } impl From> for (T, T) { /// Tuplifys the vec, (x, y). fn from(value: Vector2) -> Self { (value.x, value.y) } }