Constant words_count::NEWLINE

source ·
pub const NEWLINE: WordsCount;
Expand description

A WordsCount equivalent to words_count::count(“\n”).

It is useful when processing files a line at a time.

Example

use words_count::{count, WordsCount, NEWLINE};

let mut total = WordsCount::default();
for ln in std::io::stdin().lines() {
    total += count(ln.unwrap()) + NEWLINE;
}
println!("{total:?}");