From 4d389ad4e6223ba56ec739fca55ad2e170a06a2b Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Sun, 23 Aug 2020 14:46:27 +0200 Subject: Adding ingredient/combine separation --- rif/src/thread.rs | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'rif/src/thread.rs') 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, + pub inputs: BTreeSet, + pub outputs: BTreeSet, +} + +/// 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, + name: String, + slug: String, +} -- cgit v1.2.3