Refactor data representation and storage
Mostly moving around code
This commit is contained in:
parent
0eb745e928
commit
7a2372fedd
10 changed files with 416 additions and 379 deletions
|
|
@ -2,19 +2,19 @@ use std::fs::File;
|
|||
use std::io::{self, BufReader, BufWriter};
|
||||
use std::path::Path;
|
||||
|
||||
use crate::data::AdjacencyList;
|
||||
use crate::data::store;
|
||||
|
||||
pub fn reexport(from: &Path, to: &Path) -> io::Result<()> {
|
||||
eprintln!(">> Import");
|
||||
let mut from = BufReader::new(File::open(from)?);
|
||||
let data = AdjacencyList::read(&mut from)?;
|
||||
let data = store::read_adjacency_list(&mut from)?;
|
||||
|
||||
eprintln!(">> Consistency check");
|
||||
data.check_consistency();
|
||||
|
||||
eprintln!(">> Export");
|
||||
let mut to = BufWriter::new(File::create(to)?);
|
||||
data.write(&mut to)?;
|
||||
store::write_adjacency_list(&data, &mut to)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue