Struct textwrap::core::Word [−][src]
pub struct Word<'a> { /* fields omitted */ }
Expand description
A piece of wrappable text, including any trailing whitespace.
A Word
is an example of a Fragment
, so it has a width,
trailing whitespace, and potentially a penalty item.
Implementations
Construct a new Word
.
A trailing stretch of ' '
is automatically taken to be the
whitespace part of the word.
Break this word into smaller words with a width of at most
line_width
. The whitespace and penalty from this Word
is
added to the last piece.
Examples
use textwrap::core::Word; assert_eq!( Word::from("Hello! ").break_apart(3).collect::<Vec<_>>(), vec![Word::from("Hel"), Word::from("lo! ")] );
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Word<'a>
impl<'a> UnwindSafe for Word<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more