The Direction::vec2 function seemed to be a non-standard implementation of Into<Vec2> for Direction. This pull request changes them to trait implementations (of From since that is what is recommended by the documentation in the standard library).
The conversion from Vec2 to Direction is a TryFrom, of course, since a Vec2 only translates to a Direction when it is orthogonal to the axes, i.e., one of the components is zero.
The
Direction::vec2
function seemed to be a non-standard implementation ofInto<Vec2>
forDirection
. This pull request changes them to trait implementations (ofFrom
since that is what is recommended by the documentation in the standard library).The conversion from
Vec2
toDirection
is aTryFrom
, of course, since aVec2
only translates to aDirection
when it is orthogonal to the axes, i.e., one of the components is zero.