Add reexport command

This commit is contained in:
Joscha 2022-10-03 18:07:30 +02:00
parent 266f001d46
commit e74eee89e6
3 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,17 @@
use std::fs::File;
use std::io::{self, BufReader, BufWriter};
use std::path::Path;
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)?;
eprintln!(">> Export");
let to = BufWriter::new(File::create(to)?);
data.write(to)?;
Ok(())
}