1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
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,
}
|