[−][src]Trait textwrap::core::Fragment
A (text) fragment denotes the unit which we wrap into lines.
Fragments represent an abstract word plus the whitespace
following the word. In case the word falls at the end of the line,
the whitespace is dropped and a so-called penalty is inserted
instead (typically "-"
if the word was hyphenated).
For wrapping purposes, the precise content of the word, the whitespace, and the penalty is irrelevant. All we need to know is the displayed width of each part, which this trait provides.
Required methods
fn width(&self) -> usize
Displayed width of word represented by this fragment.
fn whitespace_width(&self) -> usize
Displayed width of the whitespace that must follow the word when the word is not at the end of a line.
fn penalty_width(&self) -> usize
Displayed width of the penalty that must be inserted if the word falls at the end of a line.