|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
use std::collections::HashSet; |
|
|
|
|
|
|
|
|
|
use std::fs; |
|
|
|
|
use std::io::{self, BufRead}; |
|
|
|
|
use std::io::{self, Write, BufRead}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub struct DB { |
|
|
|
@ -29,9 +29,18 @@ impl DB {
|
|
|
|
|
Ok(result) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//pub fn dump(&self) {
|
|
|
|
|
// TODO: implement
|
|
|
|
|
//}
|
|
|
|
|
pub fn dump(&self, path: &str) -> io::Result<()> { |
|
|
|
|
let mut file = fs::OpenOptions::new() |
|
|
|
|
.write(true) |
|
|
|
|
.append(false) |
|
|
|
|
.open(path)?; |
|
|
|
|
|
|
|
|
|
for id in self.items.iter() { |
|
|
|
|
writeln!(file, "{}", id)?; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Ok(()) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|