Skip to main content

tail_lines

Function tail_lines 

Source
pub fn tail_lines(text: &str, limit: usize) -> Vec<&str>
Expand description

Last limit lines of text in a single pass.

Memory is O(limit), not O(total lines): unlike text.lines().collect() followed by slicing off the tail, large inputs stream through a limit-sized ring instead of materializing every line transiently.