Split conversion of spaces and objects
This commit is contained in:
@@ -60,18 +60,15 @@ where
|
||||
bincode::serialize_into(writer, &data).unwrap();
|
||||
}
|
||||
|
||||
pub fn convert(name: &str) {
|
||||
// Convert Reference Space definitions
|
||||
let fn_in = format!("{}.spaces.json", name);
|
||||
let fn_out = format!("{}.spaces.bin", name);
|
||||
pub fn convert<T>(name: &str)
|
||||
where
|
||||
T: Serialize + DeserializeOwned,
|
||||
{
|
||||
// Convert definitions from json to bincode
|
||||
let fn_in = format!("{}.json", name);
|
||||
let fn_out = format!("{}.bin", name);
|
||||
|
||||
from_json::<Vec<model::Space>>(&fn_in, &fn_out);
|
||||
|
||||
// Convert Spatial Objects
|
||||
let fn_in = format!("{}.objects.json", name);
|
||||
let fn_out = format!("{}.objects.bin", name);
|
||||
|
||||
from_json::<Vec<model::SpatialObject>>(&fn_in, &fn_out);
|
||||
from_json::<T>(&fn_in, &fn_out);
|
||||
}
|
||||
|
||||
pub fn build(
|
||||
|
||||
@@ -16,7 +16,8 @@ fn main() {
|
||||
// Convert to binary the JSON data:
|
||||
if true {
|
||||
info_time!("Converting to binary JSON data");
|
||||
storage::convert("10k");
|
||||
storage::convert::<Vec<mercator_db::json::model::Space>>("10k.spaces");
|
||||
storage::convert::<Vec<mercator_db::json::model::SpatialObject>>("10k.objects");
|
||||
}
|
||||
|
||||
// Build a Database Index:
|
||||
|
||||
Reference in New Issue
Block a user