Function textwrap::core::find_words [−][src]
pub fn find_words(line: &str) -> impl Iterator<Item = Word<'_>>
Expand description
Split line into words separated by regions of ' '
characters.
Examples
use textwrap::core::{find_words, Fragment, Word}; let words = find_words("Hello World!").collect::<Vec<_>>(); assert_eq!(words, vec![Word::from("Hello "), Word::from("World!")]); assert_eq!(words[0].width(), 5); assert_eq!(words[0].whitespace_width(), 1); assert_eq!(words[0].penalty_width(), 0);