textwrap

Text Wrapping and Formatting

Functions

FunctionDescription
_tw_byte_atInternal byte reader.
_tw_copyInternal: copy bytes.
textwrap_fillWrap text at word boundaries. Inserts newlines. Returns total length.
textwrap_wrapWrap text (alias for fill).
textwrap_dedentRemove common leading whitespace from all lines.
textwrap_indentAdd prefix to each line.
textwrap_shortenTruncate text to width, adding […] if too long.

Details

_tw_byte_at

fn _tw_byte_at(buf: &i8, idx: i64) -> i64

Internal byte reader.

_tw_copy

fn _tw_copy(dst: &i8, doff: i64, src: &i8, soff: i64, n: i64)

Internal: copy bytes.

textwrap_fill

fn textwrap_fill(src: &i8, slen: i64, width: i64, out: &i8, max: i64) -> i64

Wrap text at word boundaries. Inserts newlines. Returns total length.

textwrap_wrap

fn textwrap_wrap(src: &i8, slen: i64, width: i64, out: &i8, max: i64) -> i64

Wrap text (alias for fill).

textwrap_dedent

fn textwrap_dedent(src: &i8, slen: i64, out: &i8, max: i64) -> i64

Remove common leading whitespace from all lines.

textwrap_indent

fn textwrap_indent(src: &i8, slen: i64, pfx: &i8, plen: i64, out: &i8, max: i64) -> i64

Add prefix to each line.

textwrap_shorten

fn textwrap_shorten(src: &i8, slen: i64, width: i64, out: &i8, max: i64) -> i64

Truncate text to width, adding […] if too long.