Module util

Module util 

Source
Expand description

Shared utilities for tool implementations.

Constants§

ESTIMATED_CHARS_PER_LINE
Generous estimate of average characters per line for buffer pre-allocation.
LIKELY_CHARS_PER_LINE_MAX
A number of characters per line that’s likely to not be exceeded in most files.

Functions§

format_numbered_line
Formats a line with its line number for output.
truncate_line
Truncates a single line to a maximum character count.
truncate_text
Truncates text to a maximum byte length, appending a truncation notice.