velcro 0.5.4

Convenience macros for initializing vectors, hash maps and other Rust collections.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use velcro::vec_from;

#[derive(Debug, PartialEq)]
pub struct Foo(i32);

impl From<i32> for Foo {
    fn from(other: i32) -> Self {
        Foo(other)
    }
}

fn main() {
    let foos: Vec<Foo> = vec_from![1, 2, Foo(3), ..(4..=6), 7];
    assert_eq!(
        foos,
        vec![Foo(1), Foo(2), Foo(3), Foo(4), Foo(5), Foo(6), Foo(7)]
    );
}