macro_rules! random_string {
(STR = $string:expr; $range:expr, $charset:expr) => { ... };
(STR = $string:expr; $range:expr) => { ... };
($range:expr, $charset:expr) => { ... };
($range:expr) => { ... };
}
Expand description
Generate random string.
ยงExample
Just add rand = "0.8.5"
to your crate deps then try:
// Use default charset `b"0123456789abcdef"` **NOT RECOMMEND, use RandHexStr instead**
let rs_1 = random_string!(32);
// Use custom charset
let rs_2 = random_string!(32, b"0123456789abcdefABCDEF");
// Provide your own string and the randon string will be appended to it
random_string!(STR = your_own_string; 32);
// Of course, custom charset is supported
random_string!(STR = your_own_string; 32, b"0123456789abcdefABCDEF");