Old shape ran byteindex then rewound to count runes — two passes, different algorithm from Hare. New `indexstring` mirrors ref/hare/strings/index.ha:59-81: one outer iterator over the haystack, an inner iterator re-seated from it for each candidate match, both walking rune-by-rune. Returns the rune-index of the first match, or void. Rest-iterator copy is field-wise rather than `let rest_iter = s_iter;` because the local-to-local copy of the 3-field iterator struct diverges between stages today (#41 — 993_ww_ww and 995_self_rebuild byte-diverge when written the natural way). WHY-comment cites #41 with the precise failing tests. Tests pin the rune-vs-byte distinction at i=2 and i=4 with 3-byte kana, plus self-match, empty-needle, empty-haystack, and a no-match multibyte row from ref/hare/strings/index.ha:119.
49 KiB
49 KiB