pub trait Direction<T>: Sized {
// Required methods
fn to_degrees(self) -> Degrees<T>;
fn to_radians(self) -> Radians<T>;
fn to_rotations(self) -> Rotations<T>;
fn to_cardinal(self, bias: Cardinal) -> Cardinal;
fn to_octal(self) -> Octal;
fn from_vec2(v: Vec2<T>) -> Self;
fn sin_cos(self) -> (T, T);
// Provided method
fn norm(self) -> Vec2<T> { ... }
}Expand description
A type that represents a direction in 2D space.
Required Methods§
Sourcefn to_degrees(self) -> Degrees<T>
fn to_degrees(self) -> Degrees<T>
Angle of the direction in degrees.
Sourcefn to_radians(self) -> Radians<T>
fn to_radians(self) -> Radians<T>
Angle of the direction in radians.
Sourcefn to_rotations(self) -> Rotations<T>
fn to_rotations(self) -> Rotations<T>
Angle of the direction in rotations.
Sourcefn to_cardinal(self, bias: Cardinal) -> Cardinal
fn to_cardinal(self, bias: Cardinal) -> Cardinal
Get an approximately equivalent Cardinal direction.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.