[][src]Macro pair_macro::create_pair

macro_rules! create_pair {
    ( $name: tt; $($field: tt),* ) => { ... };
}

Creates a pair type. When this macro is used out of this crate, pair_macro::create_pair_prelude must be imported.

Params

  1. name the name of the new pair type.
  2. field the fields' name.

Examples

use pair_macro::create_pair_prelude::*;

create_pair!(MyOwnPair; a, b, c, d);

let p = MyOwnPair::new(1, 2, 3, 4);
let q = MyOwnPair::new(5, 6, 7, 8);
let r = p + q;
assert_eq!(6, r.a);
assert_eq!(8, r.b);
assert_eq!(10, r.c);
assert_eq!(12, r.d);