pair_macro Build Status

Create types consisting of the same type values such that Pair, Triplet, and so on.

This crate runs on no-std environment.

Examples

Use a provided type Pair.

```rust use pair_macro::Pair;

let p = Pair::new(1, 2); let q = p.map(|v| v * 2);

asserteq!(Pair::new(2, 4), q); asserteq!(2, q.x); assert_eq!(4, q.y); ```

Create a new pair type.

```rust use pairmacro::createpair_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; asserteq!(6, r.a); asserteq!(8, r.b); asserteq!(10, r.c); asserteq!(12, r.d); ```