Recently, I found myself needing to get a character from a Rust string by an arbitrary byte index.
When I originally looked into the problem, std did not have an API for this use case.
Starting with Rust 1.91.0, str::floor_char_boundary covers much of this use case.
I still found the UTF-8 properties instructive, so in this post I would like to describe how they allow access by arbitrary byte offsets using only the underlying bit patterns.
Read more