smacro
A collection of convenient Rust macros to reduce boilerplate and improve ergonomics.
By default, only macros with no_std support are enabled.
To enable more, just add the corresponding features.
Macros
s!
A versatile macro for creating String instances with minimal syntax.
use s;
// Empty string
let empty = s!;
// Convert anything with ToString
let hello = s!;
let number = s!;
// Format strings
let name = "Alice";
let greeting = s!;
set! - Requires set feature
Create HashSet instances with initial values.
use set;
// Empty set
let empty = set!;
// Set with values
let numbers = set!;
let fruits = set!;
map! - Requires map feature
Create HashMap instances with key-value pairs.
use map;
// Empty map
let empty = map!;
// Map with initial data
let colors = map!;
License
MIT, see LICENSE