{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibllnd2e4pxttuumswajjrd4swtfjgdwqkfhvb2z4uofzp4fg3kga",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mkqlzf2hhfl2"
},
"path": "/t/sized-or-sizeable-str-e-g-str-const-n-usize/24213#post_6",
"publishedAt": "2026-04-30T21:00:00.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "kpreid:\n\n>\n> macro_rules! sizstr {\n> ($text:literal) => {\n> SizStr::<{ $text.len() }>::strict_from_ref($text)\n> };\n> }\n>\n\nIn 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.\n\nAnd this indeed seems a valid improvement – thank you:\n\nkpreid:\n\n>\n> macro_rules! sizstr {\n> ($text:literal) => {\n> const {\n> const TEXT: &str = $text;\n> SizStr::<{ TEXT.len() }>::strict_from_ref(TEXT)\n> }\n> };\n> }\n>",
"title": "Sized (or Sizeable) str, e.g. str<const N: usize>"
}