summaryrefslogtreecommitdiff
path: root/src/models
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@53hor.net>2021-03-04 18:14:12 -0500
committerAdam T. Carpenter <atc@53hor.net>2021-03-04 18:14:12 -0500
commit0c63ae51d1221b8ecd9742c7d5580bd06551ecbb (patch)
tree5c87242c295f519252db57c0eb269058e8b959c2 /src/models
parent1259dad8d561bd390262314035d5252905d1c12e (diff)
downloadtwinh-0c63ae51d1221b8ecd9742c7d5580bd06551ecbb.tar.xz
twinh-0c63ae51d1221b8ecd9742c7d5580bd06551ecbb.zip
did some templating, added some models
Diffstat (limited to 'src/models')
-rw-r--r--src/models/mod.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/models/mod.rs b/src/models/mod.rs
new file mode 100644
index 0000000..d7ff47a
--- /dev/null
+++ b/src/models/mod.rs
@@ -0,0 +1,43 @@
+use serde::{Deserialize, Serialize};
+
+#[derive(Serialize, Deserialize)]
+pub struct Car {
+ year: u16, // Yes, in 30767 years I will address this.
+ make: String,
+ model: String,
+ engine: Engine,
+ doors: u8,
+ transmission: Transmission,
+}
+
+#[derive(Serialize, Deserialize)]
+pub struct Part {
+ name: String,
+ compatible_cars: Vec<Car>,
+ sources: Vec<Source>,
+ categories: Vec<Category>,
+}
+
+#[derive(Serialize, Deserialize)]
+pub enum Source {
+ Uri(String),
+}
+
+#[derive(Serialize, Deserialize)]
+pub struct Engine {
+ cylinders: u8,
+ displacement: u16,
+ layout: Layout,
+}
+
+#[derive(Serialize, Deserialize)]
+pub enum Layout {
+ I,
+ V,
+}
+
+#[derive(Serialize, Deserialize)]
+pub struct Transmission(String);
+
+#[derive(Serialize, Deserialize)]
+pub struct Category(String);