110 lines
2.9 KiB
Rust
110 lines
2.9 KiB
Rust
// Workspace: weaponry
|
|
// File: weaponry/src/weaponry_structs/equipement_scenario.rs
|
|
//! Implementations of a full scenario,
|
|
//!
|
|
//! These implementation must take care of everything from database retrieval to view exporting,
|
|
//! however all they mostly do is glue together all the parts designed in the interface,
|
|
//! and therefore mostly serves as a TO-DO list
|
|
//!
|
|
|
|
#![allow(dead_code)]
|
|
|
|
use crate::{
|
|
error::{EquipementError, FatalEquipementError},
|
|
interfaces::{RecipeDatabase, Scenario, ViewTable},
|
|
weaponry_structs::equipement_structs::InnerEquipementStats,
|
|
};
|
|
|
|
use super::equipement_advanced_repr::RefinedEquipementList;
|
|
|
|
/// Mock of the existing database
|
|
pub struct DatabaseMock {}
|
|
impl RecipeDatabase for DatabaseMock {
|
|
fn serialize_vec_from_table<T>(
|
|
&self,
|
|
table: &str,
|
|
) -> std::result::Result<Vec<T>, crate::error::FatalEquipementError> {
|
|
let _ = table;
|
|
unimplemented!()
|
|
}
|
|
|
|
fn serialize_vec_from_table_with_query<T>(
|
|
&self,
|
|
table: &str,
|
|
query: &str,
|
|
) -> std::result::Result<Vec<T>, FatalEquipementError> {
|
|
let _ = table;
|
|
let _ = query;
|
|
unimplemented!()
|
|
}
|
|
|
|
fn new(origin: &str) -> Result<Self, FatalEquipementError>
|
|
where
|
|
Self: std::marker::Sized,
|
|
{
|
|
let _ = origin;
|
|
unimplemented!()
|
|
}
|
|
|
|
fn initialize_empty_table<T>(table: &str) -> Result<(), EquipementError> {
|
|
let _ = table;
|
|
unimplemented!()
|
|
}
|
|
}
|
|
/// Mock config
|
|
pub struct ConfigMock {}
|
|
/// Mock Viewtable
|
|
pub struct ViewtableMock {}
|
|
impl ViewTable for ViewtableMock {
|
|
type InterestElementList = RefinedEquipementList;
|
|
|
|
fn index_of_interest_points(&self) -> Vec<usize> {
|
|
todo!()
|
|
}
|
|
|
|
fn find_points_of_interest(&self, representation: &Self::InterestElementList) {
|
|
let _ = representation;
|
|
todo!()
|
|
}
|
|
}
|
|
|
|
/// A simple cross recipe scenario
|
|
#[allow(clippy::missing_docs_in_private_items)]
|
|
pub struct CrossRecipeScenario {
|
|
database: DatabaseMock,
|
|
config: ConfigMock,
|
|
}
|
|
|
|
impl Scenario for CrossRecipeScenario {
|
|
type DatabaseType = DatabaseMock;
|
|
type ViewTableType = ViewtableMock;
|
|
type FinalListType = RefinedEquipementList;
|
|
type Config = ConfigMock;
|
|
|
|
fn new_with_config(config: Self::Config) -> Result<Self, EquipementError>
|
|
where
|
|
Self: Sized,
|
|
{
|
|
Ok(Self {
|
|
// TODO: Correct this relative path abomination
|
|
database: Self::DatabaseType::new("./databases/weapons.db")?,
|
|
config,
|
|
})
|
|
}
|
|
|
|
fn generate_refined_recipes(&self) -> Self::FinalListType {
|
|
let _all_parts = &self
|
|
.database
|
|
.serialize_vec_from_table_with_query::<InnerEquipementStats>(
|
|
"bob",
|
|
"WHERE CATEGOTY == 'Bobitty'",
|
|
);
|
|
todo!()
|
|
}
|
|
|
|
fn generate_view_tables(&self, equipement_list: Self::FinalListType) -> Self::ViewTableType {
|
|
let _ = equipement_list;
|
|
todo!()
|
|
}
|
|
}
|