Skip to main content

Module wc

Module wc 

Source

Structs§

WcCounts
Results from counting a byte slice.

Functions§

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
Count lines, words, and 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 locale-aware whitespace detection.
count_words_locale
Count words with explicit locale control. C locale uses scalar table-based path. UTF-8 locale uses a state machine for correct multi-byte sequence handling.
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).
ws_table
Get the appropriate word-boundary table for the current locale. This is set once at startup and used throughout.