{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibsjibidmtxn6j7fo3bw5w3clmkcwqvqwiuegg4rgqz2sfl5aqkle",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mhcixpjox6j2"
},
"path": "/t/introduce-a-way-to-construct-range-from-start-length/24073?page=2#post_32",
"publishedAt": "2026-03-18T01:00:37.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "I think it'd be reasonable to have `Range::from_start_and_len` and `Range::try_from_start_and_len` as full functions you can write out (one panicking/wrapping and the other returning an `Option`), and then we can use `..+` or whatever other operator we want as a shorthand, like how ints have long method names for me to specify that I want `.wrapping_add` or `.saturating_add` when it's important to explicitly handle overflow, or I can just use `+` when I don't need to.\n\nI sometimes write code where `Range::try_from_start_and_len(start, len).unwrap_or(/* whatever */)` would be important to show that the case where `len` doesn't fit has been thought about and handled appropriately, and the verbosity isn't that bad when you have LSP-backed completion.",
"title": "Introduce a way to construct Range from start + length"
}