aboutsummaryrefslogtreecommitdiff
path: root/rif/src/schema.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rif/src/schema.rs')
-rw-r--r--rif/src/schema.rs49
1 files changed, 23 insertions, 26 deletions
diff --git a/rif/src/schema.rs b/rif/src/schema.rs
index 28c1304..ac3052e 100644
--- a/rif/src/schema.rs
+++ b/rif/src/schema.rs
@@ -2,37 +2,34 @@ use identity::Identity as Id;
use std::collections::BTreeSet;
/// A schema format backing a recipe set
-pub struct Schema<I, W>
-where
- I: Ingredient,
- W: Workstep,
-{
+#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
+pub struct Schema {
/// Set of ingredients present in a recipe
- pub ingredients: BTreeSet<I>,
+ pub ingredients: BTreeSet<Ingredient>,
/// Set of allowed work-steps in a recipe
- pub worksteps: BTreeSet<W>,
+ pub worksteps: BTreeSet<Workstep>,
}
-/// A string-tagged ingredient in a recipe
-pub trait Ingredient {
- /// Get a human readable ingredient name
- fn name(&self) -> String;
- /// Get the ingredient slug
- fn slug(&self) -> String;
- /// A machine-efficient, random ID
- fn id(&self) -> Id;
+#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
+pub struct Ingredient {
+ pub name: String,
+ pub slug: String,
+ pub id: Id,
}
/// An execution step
-pub trait Workstep {
- /// Get a human readable workstep name
- fn name(&self) -> String;
- /// Get the workstep slug
- fn slug(&self) -> String;
- /// Get the human readable workstep description
- fn description(&self) -> String;
- /// A machine-efficient, random ID
- fn id(&self) -> Id;
- /// Execute some custom code for the step
- fn run(&self) -> Option<()>;
+#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
+pub struct Workstep {
+ pub id: Id,
+ pub name: String,
+ pub slug: String,
+ pub description: String,
+}
+
+/// A piece of gear required to execute an action
+pub struct Material {
+ pub id: Id,
+ pub name: String,
+ pub slug: String,
+ pub description: String,
}