astr
array string
A const lenght stack str
| Unsized | Const Length | Dynamic |
|---|---|---|
| [T] (slice) | [T; LEN] (array) | Vec<T> |
| str | AStr<LEN> | String |
Example
use ;
// use the macro to infer the length of the string
let s = astr!;
assert_eq!;
// also works in const context
const S1: &'static = astr!;
// the type is also copy and sized so you can derefernce it
const S2: = *astr!;
assert_eq!;
// use try_from to convert a String
let source_string = Stringfrom;
let s2 = try_from.unwrap;
assert_eq!;