Some basic tests and basic impls

This commit is contained in:
Chaoscaot
2023-04-04 12:07:33 +02:00
parent 1df33249c4
commit a1b5449f06
9 changed files with 156 additions and 86 deletions

View File

@ -38,7 +38,7 @@ use schemsearch_sql::load_all_schematics;
#[cfg(feature = "sql")]
use crate::types::SqlSchematicSupplier;
use indicatif::*;
use schemsearch_files::Schematic;
use schemsearch_files::{SchematicVersioned};
use crate::sinks::{OutputFormat, OutputSink};
fn main() {
@ -186,7 +186,7 @@ fn main() {
threshold: *matches.get_one::<f32>("threshold").expect("Couldn't get threshold"),
};
let pattern = match Schematic::load(&PathBuf::from(matches.get_one::<String>("pattern").unwrap())) {
let pattern = match SchematicVersioned::load(&PathBuf::from(matches.get_one::<String>("pattern").unwrap())) {
Ok(x) => x,
Err(e) => {
cmd.error(ErrorKind::Io, format!("Error while loading Pattern: {}", e.to_string())).exit();
@ -303,8 +303,8 @@ fn main() {
}
}
fn load_schem(schem_path: &PathBuf) -> Option<Schematic> {
match Schematic::load(schem_path) {
fn load_schem(schem_path: &PathBuf) -> Option<SchematicVersioned> {
match SchematicVersioned::load(schem_path) {
Ok(x) => Some(x),
Err(e) => {
println!("Error while loading schematic ({}): {}", schem_path.to_str().unwrap(), e.to_string());