macro_rules! gstring {
($s:literal) => { ... };
($s:literal, $validator:ty) => { ... };
($s:literal, $validator:ty, $min:expr) => { ... };
($s:literal, $validator:ty, $min:expr, $max:expr) => { ... };
($s:literal, $validator:ty, $min:expr, $max:expr, $ascii_only:expr) => { ... };
}Expand description
Compile-time check for GString without validation.
Validation can only happen at runtime, so this macro returned crate::InValidatedGString needed to be validated.
It’s only useful for checking bounds and ASCII statically at compile-time.
§Examples
use g_string::gstring;
let ret = gstring!("aslkdm");
let ret = ret.validate().unwrap();
assert_eq!(ret, "aslkdm");
// let ret = gstring!("aslkdm", (), 2, 4); // won't even compile