Crates.io | lit-vek |
lib.rs | lit-vek |
version | 0.1.0 |
source | src |
created_at | 2023-03-14 22:19:46.264768 |
updated_at | 2023-03-14 22:19:46.264768 |
description | iter! and vek! macros for nicer literal syntax |
homepage | |
repository | https://github.com/jpetkau/lit-vek |
max_upload_size | |
id | 810273 |
size | 24,117 |
Rust crate that defines macros to enable ES-like "spread" syntax for literal sequences.
let arr = [4, 5, 6];
// `vek!` is a drop-in replacement for `std::vec!`, except you can
// use `...x` to expand iterables.
assert_eq!(
vek![1, 2, 3, ...arr, 7, 8, 9],
[1, 2, 3, 4, 5, 6, 7, 8, 9]);
// `iter!` provides the same syntax but produces an `Iterator`.
# use std::collections::VecDeque;
let d: VecDeque<_> = iter![1, 2, 3, ...arr, 7, 8, 9].collect();