macro_rules! x_times {
    () => { ... };
    ($a:expr $(,)*) => { ... };
    ($a:expr, $b:expr $(,)*) => { ... };
}
Expand description

Based on x_times()

Examples:

#[macro_use] extern crate serde_json_lodash;
use serde_json::json;
assert_eq!(
  x_times!(3, |i| json!(i.to_string())),
  json!(["0","1","2"])
);
assert_eq!(
  x_times!(4, |_| json!(0)),
  json!([0,0,0,0])
);

More examples:

assert_eq!(x_times!(), json!([]));
assert_eq!(x_times!(0), json!([]));
assert_eq!(x_times!(2), json!([0,1]));