You can probably use https://doc.rust-lang.org/std/primitive.str.html#method.char_indices here to avoid copying the strings into chars_buf entirely -- you could just find the correct offset and then copy the relevant bytes
If you wanted to get super fancy, you could add specializations for:
- Scalar
n (no need to expand it out to an array)
- StringViewArray (no need to copy strings at all, you could just adjust the views)
However, this code seems better than what is on main! So we can merge it too and keep iterating
Originally posted by @alamb in #19571 (comment)