diff options
Diffstat (limited to 'rif/src/thread.rs')
-rw-r--r-- | rif/src/thread.rs | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/rif/src/thread.rs b/rif/src/thread.rs index c543850..5de9cd5 100644 --- a/rif/src/thread.rs +++ b/rif/src/thread.rs @@ -1 +1,41 @@ -pub struct Thread {} +use crate::{Ingredient, Workstep}; +use std::collections::BTreeSet; + +#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] +pub struct Thread { + pub name: String, + pub instructions: Vec<Instruction>, + pub inputs: BTreeSet<Measure>, + pub outputs: BTreeSet<Measure>, +} + +/// An ingredient with precise attached measurements +#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] +pub struct Measure { + /// Base ingredient from the schema + pub ingredient: Ingredient, + /// Numerical amount + pub amount: usize, + /// Scale offset + pub scale: u64, +} + +/// Differentiator between raw schema ingredient or work result +pub enum IngredientLike { + /// An ingredient backed by the recipe schema + Raw(Ingredient), + /// An ingredient produced by a subset of the recipe + Combine(Combine), +} + +/// A specific variation of a `Workstep` which acts on Measures +#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] +pub struct Instruction {} + +/// The result of an instruction, which is not a base ingredient +#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] +pub struct Combine { + inputs: BTreeSet<IngredientLike>, + name: String, + slug: String, +} |