lemunozm / ruscii

Terminal graphics engine: build your games in the terminal!
Apache License 2.0
171 stars 15 forks source link

Changed to From implementations between Vec2 and Direction. #26

Closed pumken closed 1 year ago

pumken commented 1 year ago

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.