Sized (or Sizeable) str, e.g. str<const N: usize>
Rust Internals [Unofficial]
April 30, 2026
kpreid:
macro_rules! sizstr { ($text:literal) => { SizStr::<{ $text.len() }>::strict_from_ref($text) }; }
In a nutshell, that’s the base case of my stringlet!() macro, yes. But I get a feeling that many people don’t like macros. Some crates even hide them in an optional feature. I was wanting to make the functional folks happy as well.
And this indeed seems a valid improvement – thank you:
kpreid:
macro_rules! sizstr { ($text:literal) => { const { const TEXT: &str = $text; SizStr::<{ TEXT.len() }>::strict_from_ref(TEXT) } }; }
Discussion in the ATmosphere