macro_rules! random_str {
($range:expr, $charset:expr) => { ... };
(HEX) => { ... };
(HEX: $l:expr) => { ... };
(HEX: $l:expr, $rp:expr) => { ... };
(HEX: $l:expr, $rp:expr, $lp:expr) => { ... };
}
Expand description
See RandStr
and RandHexStr
for more information.
ยงExample
use macro_toolset::{random_str, string_v2::PushAnyT};
let mut string = String::new();
string.push_any(random_str!(16, b"abcABC123"));
string.push_any(random_str!(HEX)); // 16 (default, max 16) * 1 (default) + 0 (default, max 16)
string.push_any(random_str!(HEX: 16)); // 16 * 1 (default) + 0 (default)
string.push_any(random_str!(HEX: 16, 3)); // 16 * 3 + 0 (default)
string.push_any(random_str!(HEX: 16, 3, 8)); // 16 * 3 + 8
// If you like, just to_string_ext
is fine.
use macro_toolset::{random_str, string_v2::StringExtT};
let string = random_str!(16, b"abcABC123").to_string_ext();