Skip to main content

Module utils_fns

Module utils_fns 

Source

Functions§

binary_search_exact_pos
Performs a binary search on a sorted vec of IIDs to find the exact position where the row == target_row. Assumes the vec is sorted by row numbers. Returns Some(pos) if found, None if not present, or an error if any accessed IID lacks a row mapping.
binary_search_ins_pos
Performs a binary search on a sorted vec of IIDs to find the leftmost insertion point where the row >= target_row. Assumes the vec is sorted by row numbers. Returns the insertion index or an error if any accessed IID lacks a row mapping.
n_to_base62
Converts a usize to a compact String using base-62 bijective encoding (A-Z, a-z, 0-9). This is more efficient than base-26 as it uses 62 symbols, resulting in shorter strings. It’s repeatable: same input yields same output. Handles usize::MAX as a special case to avoid overflow.
natural_text_segments
natural_text_segments_cs