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, Deref(for accessing inner value).

In addition, Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOr are Derived.


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