Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::fs;
- use std::io::prelude::*;
- use std::io::BufReader;
- let buf = BufReader::new(fs::File::open("log.log").expect("no such file"));
- let lines: Vec<String> = buf
- .lines()
- .map(|l| l.expect("Could not parse line"))
- .collect();
- let mut output = String::new();
- lines.iter().rev().take(10).rev().for_each(|line| {
- output.push_str(&line);
- output.push('\n');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement