{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreibhi4reg6hmbthyqgoggst4ymvnmbbxov75uzbrqfzn34bsx2qd2i",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mgyfql2duqf2"
  },
  "path": "/t/introduce-a-way-to-construct-range-from-start-length/24073?page=2#post_22",
  "publishedAt": "2026-03-13T17:33:47.000Z",
  "site": "https://internals.rust-lang.org",
  "tags": [
    "RangeBounds in std::ops - Rust"
  ],
  "textContent": "appleGun22:\n\n> Doesn't have a possibility to express an invalid (`start > end`) range\n\nIt still does, just via things like `200_u8 ..+ 100`.\n\nappleGun22:\n\n> Is generally the more natural way to express a range\n\nUnfortunately it works very poorly with general ranges in other places. `\"a\"..\"b\"` works fine, and is even used in things like `BTreeMap` methods.\n\nBut if you had something like `\"a\" ..+ 10`, what does that mean? It clearly can't implement RangeBounds in std::ops - Rust, for example.\n\nI think if you want the \"counted\" part, separating it out is useful. `my_btree.range(start..).take(count)`, for example, works well.\n\nappleGun22:\n\n> Reduce boilerplate (repeating `start`)\n\nHow about just a function? `Range::from_start_and_len(start, length)` would be fine, no new type.",
  "title": "Introduce a way to construct Range from start + length"
}