brave/adblock-rust

twoway crate is unmaintained

Closed this issue · 3 comments

The twoway crate used for fast string matching was recently marked as unmaintained. It would be good to migrate away to avoid triggering audit warnings.

The (former) maintainers recommend using memchr but at first glance that supports byte slices but has no equivalent to twoway::find_str, so in practice it may need to be some combination of std::str::find and mem(r)chr with byte string literals and .as_bytes() whichever benchmarks better.

When closing this, please also close brave/brave-browser#28228 (but not before the fix is present on all release branches, or the issue will be automatically reopened).

Just noting that memchr does have memmem for substring find.

🙏