{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreib2f44gx3p4kaoysxyv3ic6gbk62nqhqv7syyzd3bluj3poh5c2ke",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mhet4j3pspq2"
  },
  "path": "/t/introduce-a-way-to-construct-range-from-start-length/24073?page=2#post_36",
  "publishedAt": "2026-03-18T16:17:41.000Z",
  "site": "https://internals.rust-lang.org",
  "textContent": "There is a natural way to define steps on strings which is used frequently in theoretical computer science for algorithms/proofs which enumerate all strings: you simply change the ordering such that all shorter strings appear before all longer strings (equivalently, left pad the strings with “-1 characters” to the same length before comparison). Unfortunately, this would be mismatched with Rust’s `Ord` implementation for strings/vectors so cannot be used to implement `Step` for strings.\n\nEither way, however, I’m hard pressed to imagine a case where what you want is a range of specific length over strings rather than characters since even under this definition, between `\"z\"` and `\"aa\"` you have an annoying to compute number of hundreds/thousands of strings including non-alphabetic and, more broadly, non-printable characters that you’d need to account for.",
  "title": "Introduce a way to construct Range from start + length"
}