diff options
author | Katharina Fey <kookie@spacekookie.de> | 2020-08-23 14:46:27 +0200 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2020-08-23 14:46:27 +0200 |
commit | 4d389ad4e6223ba56ec739fca55ad2e170a06a2b (patch) | |
tree | c4c2a90cb3a52cd7822706ddeb1d2be8620c44db /rif/src/thread.rs | |
parent | 9f00deb9fcb35f43c2511a0ea562eed33271c723 (diff) |
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, +} |