mirror of
https://github.com/Chaoscaot/schemsearch.git
synced 2025-11-04 21:54:00 +01:00
Some basic tests and basic impls
This commit is contained in:
@ -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());
|
||||
|
||||
@ -19,7 +19,7 @@ use std::path::PathBuf;
|
||||
#[cfg(feature = "sql")]
|
||||
use futures::executor::block_on;
|
||||
#[allow(unused_imports)]
|
||||
use schemsearch_files::Schematic;
|
||||
use schemsearch_files::SpongeV2Schematic;
|
||||
#[cfg(feature = "sql")]
|
||||
use schemsearch_sql::{load_schemdata, SchematicNode};
|
||||
|
||||
@ -46,9 +46,9 @@ pub struct SqlSchematicSupplier {
|
||||
|
||||
#[cfg(feature = "sql")]
|
||||
impl SqlSchematicSupplier {
|
||||
pub fn get_schematic(&self) -> Result<Schematic, String> {
|
||||
pub fn get_schematic(&self) -> Result<SchematicVersioned, String> {
|
||||
let schemdata = block_on(load_schemdata(self.node.id));
|
||||
Schematic::load_data(schemdata.as_slice())
|
||||
SchematicVersioned::load_data(schemdata.as_slice())
|
||||
}
|
||||
|
||||
pub fn get_name(&self) -> String {
|
||||
|
||||
Reference in New Issue
Block a user