Base impl for export
This commit is contained in:
parent
36e1b84ae8
commit
06c74639ff
|
|
@ -9,10 +9,16 @@
|
|||
use std::rc::Rc;
|
||||
|
||||
/// This element can be converted to tex
|
||||
pub trait ToTex {}
|
||||
pub trait ToTex {
|
||||
/// Export the object to a Tex string
|
||||
fn to_tex() -> String;
|
||||
}
|
||||
|
||||
/// Specify this element can be made from parts (Unsure, maybe a way to ensure Add is presend ?)
|
||||
pub trait FromParts {}
|
||||
/// This element can be converted to a csv for further analysis
|
||||
pub trait ToAnalysis {
|
||||
/// Convert this object into a csv
|
||||
fn to_csv() -> String;
|
||||
}
|
||||
|
||||
/// Trait implemented for the final collection of a recipe, allowing it to be combined with parts
|
||||
///
|
||||
|
|
|
|||
|
|
@ -15,6 +15,21 @@ macro_rules! add_to_vec {
|
|||
}};
|
||||
}
|
||||
|
||||
/// Adds either of the vectors or merge them
|
||||
macro_rules! add_two_options {
|
||||
($self: expr, $rhs: expr) => {{
|
||||
match ($self.clone(), $rhs.clone()) {
|
||||
(None, None) => None,
|
||||
(None, Some(a)) => Some(a),
|
||||
(Some(a), None) => Some(a),
|
||||
(Some(mut a), Some(mut b)) => {
|
||||
a.0.append(&mut b.0);
|
||||
Some(a)
|
||||
}
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
impl std::ops::Add for &InnerStats {
|
||||
type Output = InnerStats;
|
||||
|
||||
|
|
@ -34,17 +49,7 @@ impl std::ops::Add for &InnerStats {
|
|||
armor_break: self.armor_break + rhs.armor_break,
|
||||
armor_pierce: self.armor_pierce + rhs.armor_pierce,
|
||||
antimaterial: self.antimaterial + rhs.antimaterial,
|
||||
damage_type: {
|
||||
match (self.damage_type.clone(), rhs.damage_type.clone()) {
|
||||
(None, None) => None,
|
||||
(None, Some(a)) => Some(a),
|
||||
(Some(a), None) => Some(a),
|
||||
(Some(mut a), Some(mut b)) => {
|
||||
a.0.append(&mut b.0);
|
||||
Some(a)
|
||||
}
|
||||
}
|
||||
},
|
||||
damage_type: add_two_options!(self.damage_type, rhs.damage_type),
|
||||
protection: self.protection + rhs.protection,
|
||||
integrity: self.integrity + rhs.integrity,
|
||||
torque_two_handed: self.torque_two_handed + rhs.torque_two_handed,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
// Workspace: weaponry
|
||||
// File: weaponry/src/weaponry_structs/equipement_tools.rs
|
||||
//! Tools user facing, implement all that a end user would need
|
||||
//!
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
/// Tooling utility
|
||||
fn load_database() {}
|
||||
|
||||
/// Export the data generated to tex
|
||||
fn export_to_tex() {}
|
||||
|
||||
/// Export the data generated to csv
|
||||
fn export_to_csv() {}
|
||||
|
|
@ -23,6 +23,7 @@ mod equipement_impl_io;
|
|||
mod equipement_impl_logic;
|
||||
mod equipement_impl_math;
|
||||
pub mod equipement_structs;
|
||||
pub mod equipement_tools;
|
||||
|
||||
// Republishes the most used symbols
|
||||
// All generic structs
|
||||
|
|
|
|||
Loading…
Reference in New Issue