Macro num_alias::int_alias [] [src]

macro_rules! int_alias {
    ($alias:ident, $type:ty) => { ... };

A simple macro to Declare alias for Integer types and implement arithmetics.

Concretely, it implements for the alias type, Add, Sub, Mul, Div, Rem, AddAssign, SubAssign, MulAssign, DivAssign, RemAssign. And Debug, Copy, Clone, PartialEq, PartialOrd, Eq, Ord are Derived.

You can access its value by deref.


extern crate num_alias;
fn main() {
    int_alias!(Val, i32);
    let a = Val(5);
    let b = Val(4);
    let c = a * b;