Skip to content

Provide a `set!` macro that creates a new map collection then inserts key-value pairs.

Notifications You must be signed in to change notification settings

SixArm/set-rust-crate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

set! macro Rust crate

This crate provides set! macros to create set collections and insert elements. This is inspired by the vec! macro.

set! macro

Create a new set collection and insert elements.

Example with tuple syntax:

let m = set!((1, 2), (3, 4));

Example with arrow syntax:

let m = set!(1 => 2, 3 => 4);

Equivalent Rust standard code:

let mut m = HashSet::new();
m.insert(1, 2);
m.insert(3, 4);

set_insert! macro

Use an existing set collection and insert elements.

Example with tuple syntax:

let mut m = HashSet::new();
set_insert!(m, (1, 2), (3, 4));

Example with arrow syntax:

let mut m = HashSet::new();
set_insert!(m, 1 => 2, 3 => 4);

Equivalent Rust std code with method `insert``:

let mut m = HashSet::new();
m.insert(1, 2);
m.insert(3, 4);

About

Provide a `set!` macro that creates a new map collection then inserts key-value pairs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages