Skip to main content

Module tr

Module tr 

Source

Functions§

complement
Parse a tr character set string into a Vec of expanded characters.
delete
delete_mmap
Delete from mmap’d byte slice. Uses SIMD memchr for single-character delete (common case). For multi-char delete, uses 8-byte unrolled scan with bitset lookup.
delete_squeeze
delete_squeeze_mmap
Delete + squeeze from mmap’d byte slice.
expand_set2
Expand SET2 to match SET1 length for translation. If SET2 has [c*] repeats, fill them. Otherwise repeat last char.
parse_set
Parse a SET string into expanded bytes.
squeeze
squeeze_mmap
Squeeze from mmap’d byte slice. Uses a two-pass approach: find runs of squeezable bytes with memchr, then copy non-squeezed content in bulk.
translate
translate_mmap
Translate bytes from an mmap’d byte slice — zero syscall reads. Uses SIMD AVX2 for range-delta patterns (e.g., a-z → A-Z). For large inputs, translates in parallel using rayon for maximum throughput.
translate_squeeze
translate_squeeze_mmap
Translate + squeeze from mmap’d byte slice. Uses a two-pass approach for the common case where few bytes are squeezed: translate first (using SIMD when possible), then squeeze.