Create types consisting of the same type values such that Pair, Triplet, and so on.
This crate runs on no-std
environment.
In your Cargo.toml
:
pair_macro = "0.1.2"
Pair
.```rust use pair_macro::Pair;
let p = Pair::new(1.0, 2.0); // Pair
asserteq!(Pair::new(2.0, 4.0), q); asserteq!(2.0, q.x); assert_eq!(4.0, q.y); ```
```rust use pairmacro::createpair_prelude::*;
create_pair!(MyOwnPair; a, b, c, d);
let p = MyOwnPair::new(1, 2, 3, 4); // MyOwnPair
Pair types support serialize/deserialize by enabling serde feature.
In your Cargo.toml
:
pair_macro = { version = "0.1.2", features = ["serde"] }