Macro faster::tuplify [] [src]

macro_rules! tuplify {
    (1, $i:expr) => { ... };
    (2, $i:expr) => { ... };
    (3, $i:expr) => { ... };
    (4, $i:expr) => { ... };
    (5, $i:expr) => { ... };
    (6, $i:expr) => { ... };
    (7, $i:expr) => { ... };
    (8, $i:expr) => { ... };
    (9, $i:expr) => { ... };
    (10, $i:expr) => { ... };
    (11, $i:expr) => { ... };
    (12, $i:expr) => { ... };
}

A macro which takes a number n and an expression, and returns a tuple containing n copies of the expression. Only works for numbers less than or equal to 12.

#[macro_use] extern crate faster;
use faster::*;

assert_eq!(tuplify!(2, 1), (1, 1));
assert_eq!(tuplify!(5, "hi"), ("hi", "hi", "hi", "hi", "hi"));
assert_eq!(tuplify!(3, i8s::splat(0)), (i8s::splat(0), i8s::splat(0), i8s::splat(0)));