this post was submitted on 20 Aug 2026
41 points (100.0% liked)

Rust

8234 readers
154 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 3 years ago
MODERATORS
top 5 comments
sorted by: hot top controversial new old
[–] shape_warrior_t@programming.dev 8 points 13 hours ago (1 children)

There's a good chance I can make use of str::substr_range on a current project of mine. I'll be storing some substrings from str::split, and now I can store the original string and ranges of indices into it instead of making an owned string for every substring.

[–] TehPers@beehaw.org 4 points 12 hours ago

substr_range is awesome. There's so many times where knowing where in the string the substring is from would have been helpful, especially with parsing. For example, you can calculate where in the input a particular token comes from and even select the full original source that matches a particular pattern by parsing, then calculating what was parsed from the cursor's new position (what's the remainder's range?) and the starting position (what was the range before parsing the pattern?).

[–] BartyDeCanter@piefed.social 11 points 17 hours ago (1 children)

Oh! The algebraic methods will be nice at work.

[–] Ephera@lemmy.ml 4 points 15 hours ago (1 children)

Yeah, those look really useful for gamedev or simulations, where you need the speed and don't particularly care that it's always the same result...

[–] xav@programming.dev 4 points 12 hours ago

Quick ! Someone should create a floating-point type where basic maths ops delegate to these new things.