4 ms·
The bytes are assumed to be utf8 (I was using the safer `from_utf8` prior to confirming the data was utf8). I brought in `twoway` when I couldn't find a way to
by daakus 5y ago
The bytes are assumed to be utf8 (I was using the safer `from_utf8` prior to confirming the data was utf8).
I brought in `twoway` when I couldn't find a way to `rfind` using `aho-corasick`. I'll switch the use over for consistency.
Thanks for the quick code review!
PS: Thanks for ripgrep too!
- burntsushi 5y agoAh gotya. Yeah, I haven't added reverse searching to aho-corasick yet. Ran out of steam. Either way, my point here is to be a counter-balance. To be fair, you did say, "But with Rust I managed to safely use." But the code you posted is technically unsound. It's not a huge deal if you know you'll always be feeding the program valid UTF-8. But it is worth mentioning here in this HN thread that is specifically comparing the safety properties of competing programming languages. :-)
- daakus 5y agoCorrect and fair. Updated the code to remove the safety issue.
- burntsushi 5y agoThank you. :-)