proptest/product_tuple.rs
1//-
2// Copyright 2017, 2018 The proptest developers
3//
4// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7// option. This file may not be copied, modified, or distributed
8// except according to those terms.
9
10//! Defines macros for product type creation, extraction, and the type signature
11//! itself. This version uses tuples.
12
13macro_rules! product_type {
14 ($factor: ty) => {
15 ($factor,)
16 };
17 ($($factor: ty),*) => {
18 ( $( $factor, )* )
19 };
20 ($($factor: ty),*,) => {
21 ( $( $factor, )* )
22 };
23}
24
25macro_rules! product_pack {
26 ($factor: expr) => {
27 ($factor,)
28 };
29 ($($factor: expr),*) => {
30 ( $( $factor ),* )
31 };
32 ($($factor: expr),*,) => {
33 ( $( $factor ),* )
34 };
35}
36
37macro_rules! product_unpack {
38 ($factor: pat) => {
39 ($factor,)
40 };
41 ($($factor: pat),*) => {
42 ( $( $factor ),* )
43 };
44 ($($factor: pat),*,) => {
45 ( $( $factor ),* )
46 };
47}