FilePrinter: Add print_file_custom(), print_files_custom()

This commit is contained in:
Matthias Beyer 2015-12-28 13:56:01 +01:00
parent 24187f9ea9
commit fc42d6b4bf
1 changed files with 15 additions and 0 deletions

View File

@ -23,6 +23,21 @@ pub trait FilePrinter {
} }
} }
fn print_file_custom<F>(&self, file: Rc<RefCell<File>>, f: &F)
where F: Fn(Rc<RefCell<File>>) -> String
{
info!("{}", f(file));
}
fn print_files_custom<F, I>(&self, files: I, f: &F)
where I: Iterator<Item = Rc<RefCell<File>>>,
F: Fn(Rc<RefCell<File>>) -> String
{
for file in files {
self.print_file_custom(file, f);
}
}
} }
struct DebugPrinter { struct DebugPrinter {