pub fn contains_ci(needle: &str, haystack: &str) -> boolExpand description
Allocation-free, case-insensitive substring test.
needle MUST already be lowercased (via str::to_lowercase).
Measured, and rejected for the text-search hot path — see
tests/contains_ci.rs::ab_contains_ci_vs_tolowercase. On a 23,000-block
corpus this costs ~4.9 µs per block against ~0.9 µs for the idiomatic
hay.to_lowercase().contains(q). The standard search is a SIMD two-way
scan and beats a hand-rolled byte loop by roughly 5×, so the per-block
temporary it saves costs far more than the temporary itself. The text
search therefore still uses to_lowercase() + contains(); this function
is kept as a tested utility for callers that genuinely cannot allocate
(a no_std target, or a caller already holding a lowercased needle that
must avoid a second temporary).
Correctness is that of haystack.to_lowercase().contains(needle), checked
exhaustively over every substring of a Hungarian fixture by the test suite.