blob: 28c130467d38749d6d4518751c26177515c3bd14 (
plain)
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
|
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,
{
/// Set of ingredients present in a recipe
pub ingredients: BTreeSet<I>,
/// Set of allowed work-steps in a recipe
pub worksteps: BTreeSet<W>,
}
/// 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;
}
/// 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<()>;
}
|