Random byte-offset access into strings in Rust

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

Table of contents

#c++ #htmx #java #js #ml #polars #python #rust #testing

    2026

  1. 2025

  2. 2024

  3. 2023

  4. 2022

  5. 2021

  6. 2020

  7. 2019

  8. 2018

  9. 2017

  10. 2016

  11. 2015

  12. 2014

  13. 2013