{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreiadob6a7yvxwv7eifwne5pbchi3ekgit7wra4s5w65tr4motdzc3a",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mkqspu7bpiq2"
},
"path": "/t/sized-or-sizeable-str-e-g-str-const-n-usize/24213#post_8",
"publishedAt": "2026-04-30T23:36:14.000Z",
"site": "https://internals.rust-lang.org",
"tags": [
"@CAD97"
],
"textContent": "daniel-pfeiffer:\n\n> 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.\n\nThe common reason why _procedural_ macros are often an optional feature is that they can have significant extra cost to compile the macro crate and its dependencies. `macro_rules` macros have no comparable cost, so you will generally not find `macro_rules` macros gated by features.\n\nI’m against macro overuse myself, but “this can’t be done without a macro except by counting bytes“ is a good reason to use a macro; and in my opinion, all you need to do is offer _some_ non-macro way to do whatever the task is, and the `fn strict_from_ref()` in my example code or @CAD97’s `new()` does that.",
"title": "Sized (or Sizeable) str, e.g. str<const N: usize>"
}