pl_hlist/macros.rs
1//
2// Copyright (c) 2015-2019 Plausible Labs Cooperative, Inc.
3// All rights reserved.
4//
5// HList macro implementations based on:
6// https://github.com/epsilonz/shoggoth.rs
7//
8
9/// Shorthand for building an `HList` from the given elements.
10///
11/// # Examples
12///
13/// ```
14/// use pl_hlist::*;
15///
16/// # fn main() {
17/// let x: HCons<u8, HCons<u32, HNil>> = hlist!(1u8, 666u32);
18/// # }
19/// ```
20#[macro_export]
21macro_rules! hlist {
22 {} => {
23 HNil
24 };
25 { $head:expr } => {
26 HCons($head, HNil)
27 };
28 { $head:expr, $($tail:expr),+ } => {
29 HCons($head, hlist!($($tail),+))
30 };
31}