lit-vek

Crates.iolit-vek
lib.rslit-vek
version0.1.0
sourcesrc
created_at2023-03-14 22:19:46.264768
updated_at2023-03-14 22:19:46.264768
descriptioniter! and vek! macros for nicer literal syntax
homepage
repositoryhttps://github.com/jpetkau/lit-vek
max_upload_size
id810273
size24,117
Jeff Petkau (jpetkau)

documentation

README

vek

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();
Commit count: 9

cargo fmt