Macro frunk_core::hlist
[−]
[src]
macro_rules! hlist { () => { ... }; ($single: expr) => { ... }; ($first: expr, $( $repeated: expr ), +) => { ... }; ($first: expr, $( $repeated: expr, ) +) => { ... }; ($first: expr, ) => { ... }; }
Returns an HList
based on the values passed in.
Helps to avoid having to write nested HCons
.
Examples
let h = hlist![13.5f32, "hello", Some(41)]; let (h1, (h2, h3)) = h.into_tuple2(); assert_eq!(h1, 13.5f32); assert_eq!(h2, "hello"); assert_eq!(h3, Some(41)); // Also works when you have trailing commas let h4 = hlist!["yo",]; let h5 = hlist![13.5f32, "hello", Some(41),]; assert_eq!(h4, hlist!["yo"]); assert_eq!(h5, hlist![13.5f32, "hello", Some(41)]);Run