television_utils

Module strings

Source

Structs§

ReplaceNonPrintableConfig

Constants§

EMPTY_STRING
PRINTABLE_ASCII_THRESHOLD
The threshold for considering a buffer to be printable ASCII.
TAB_WIDTH

Functions§

make_matched_string_printable
Make a matched string printable while preserving match ranges in the process.
next_char_boundary
Returns the index of the next character boundary in the given string.
preprocess_line
Preprocesses a line of text for display.
prev_char_boundary
Returns the index of the previous character boundary in the given string.
proportion_of_printable_ascii_characters
Returns the proportion of printable ASCII characters in the given buffer.
replace_non_printable
Replaces non-printable characters in the given byte slice with default printable characters.
shrink_with_ellipsis
Shrink a string to a maximum length, adding an ellipsis in the middle.
slice_at_char_boundaries
Returns a slice of the given string that starts and ends at character boundaries.
slice_up_to_char_boundary
Returns a slice of the given string that starts at the beginning and ends at a character boundary.
try_parse_utf8_char
Attempts to parse a UTF-8 character from the given byte slice.