pub type UntilPredicate = dyn Fn(i32, bool) -> bool;
Signature for a predicate that takes an offset into a UTF-16 string, and a boolean that indicates the search direction.