Skip to main content Module wc Copy item path Source WcCounts Results from counting a byte slice. count_all Count all metrics using optimized individual passes. count_bytes Count bytes. Trivial but included for API consistency. count_chars Count characters, choosing behavior based on locale. count_chars_c Count characters in C/POSIX locale (each byte is one character). count_chars_parallel Count UTF-8 characters in parallel. count_chars_utf8 Count UTF-8 characters by counting non-continuation bytes.
A continuation byte has the bit pattern 10xxxxxx (0x80..0xBF).
Every other byte starts a new character (ASCII, multi-byte leader, or invalid). count_lines Count newlines using SIMD-accelerated memchr.
GNU wc counts newline bytes (\n), not logical lines. count_lines_parallel Count newlines in parallel using SIMD memchr + rayon. count_lines_words Count lines and words in a single pass using 64-byte bitmask blocks. count_lines_words_chars_utf8 Count lines, words, and UTF-8 chars in a single pass using 64-byte bitmask blocks. count_lwc_parallel Combined parallel counting of lines + words + chars. count_words Count words using SIMD-accelerated whitespace detection + popcount. count_words_parallel Count words in parallel with boundary adjustment. is_utf8_locale Detect if the current locale uses UTF-8 encoding. max_line_length Compute maximum display width, choosing behavior based on locale. max_line_length_c Compute maximum display width of any line (C/POSIX locale). max_line_length_utf8 Compute maximum display width of any line (UTF-8 locale).