News for hackers. Stuff that matters.
Re:A half-hour to learn Rust by dmit on Saturday February 29, 2020 @01:14PM (#22451984)
Would a macro work ok for you, like the inbuilt vec! one? There's a crate for that named maplit: https://docs.rs/maplit

    let map = hashmap!{
        "a" => 1,
        "b" => 2,
    };
Re:A half-hour to learn Rust by gameswithgo on Saturday February 29, 2020 @01:33PM (#22452097)
one of the fun things about Rust, is any time you think "man I wish there was some syntax to do this thing in Rust" you can make a macro to make it reality, usually one already exists.