embedded_graphics::geometry

Trait AngleUnit

Source
pub trait AngleUnit {
    // Required methods
    fn deg(self) -> Angle;
    fn rad(self) -> Angle;
}
Expand description

AngleUnit trait.

AngleUnit is a trait to convert numbers into angle by appending .deg() or .rad() to the number as if it was a unit.

§Examples

§Create an Angle from a value using AngleUnit

use embedded_graphics::geometry::AngleUnit;
use core::f32::consts::PI;

// Create an angle using the `AngleUnit` methods
let angle_a = 30.0.deg();
let angle_b = PI.rad();

Required Methods§

Source

fn deg(self) -> Angle

Convert a number (interpreted as degrees) to an Angle.

Source

fn rad(self) -> Angle

Convert a number (interpreted as radians) to an Angle.

Implementations on Foreign Types§

Source§

impl AngleUnit for f32

Source§

fn deg(self) -> Angle

Source§

fn rad(self) -> Angle

Implementors§