Refactor export and add page length

This commit is contained in:
Joscha 2022-10-03 22:14:58 +02:00
parent d910047b48
commit f71092058b
3 changed files with 123 additions and 74 deletions

View file

@ -6,15 +6,15 @@ use crate::data::AdjacencyList;
pub fn reexport(from: &Path, to: &Path) -> io::Result<()> {
eprintln!(">> Import");
let from = BufReader::new(File::open(from)?);
let data = AdjacencyList::read(from)?;
let mut from = BufReader::new(File::open(from)?);
let data = AdjacencyList::read(&mut from)?;
eprintln!(">> Consistency check");
data.check_consistency();
eprintln!(">> Export");
let to = BufWriter::new(File::create(to)?);
data.write(to)?;
let mut to = BufWriter::new(File::create(to)?);
data.write(&mut to)?;
Ok(())
}