onyx 0.2.0

A simple engine for simple minds
Documentation
use std::ops::*;

pub trait Real: Copy + Clone + PartialEq + PartialOrd +
    Add<Self, Output=Self> + AddAssign<Self> +
    Sub<Self, Output=Self> + SubAssign<Self> +
    Mul<Self, Output=Self> + MulAssign<Self> +
    Div<Self, Output=Self> + DivAssign<Self> {
    fn zero() -> Self;
    fn one() -> Self;
    fn two() -> Self { Self::one() + Self::one() }
}

macro_rules! impl_real {
    ($type: ty) => {
        impl Real for $type {
            fn zero() -> Self { 0.0 }
            fn one() -> Self { 1.0 }
            fn two() -> Self { 2.0 }
        }
    }
}

impl_real!(f32);
impl_real!(f64);