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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//! Dedicated to collecting the pipelines output
//!
//! Speaking of *pipeline*, *Builder* is an entrypoint opening the door for processing data through pipeline
//! Once specifying all the necessary, we can consume the to get the final look of initial data via `.collect()`
//!
//! The `builder` module brings forth 2 kinds of Builder
//! - `Builder`: for the trivial collection of transformation where each step doesn't compel particular relation
//! - `GuardedBuilder`: comes in handy if ORDER is matter. Steps allow any arbitrary steps or a specific one preceding it.
use PhantomData;
use crate::;
/// The entry point for creating a new transformation pipeline.
///
/// ```rust
/// use hamon::errors::Result;
/// use hamon::prelude::*;
/// struct Add(i32);
///
/// impl Decorator<i32, i32> for Add {
/// fn produce(&mut self, input: i32) -> Result<i32> {
/// println!("{:<10}: previous value was {}", "[ADD]", input);
/// Ok(self.0 + input)
/// }
/// }
///
/// let engine = Builder::new(10)
/// .step(Add(2))
/// .collect(); // 12
/// ```
/// Serves the same purpose as [`Builder`] except adding an assurance for type registration
///
/// Under certain scenarios, when the order matters. Some steps cannot be performed unless
/// others have completed.
///
/// This builder shines when the arbitrary appearance of Step must be certain at some points
/// ```rust
/// struct Encyption;
/// #[derive(AllowStep)]
/// #[from(Encyption)]
/// struct Compression;
///
/// let _result = OrderedBuilder::new(10)
/// .step(Encyption)
/// .step(Compression)
/// .collect();
/// ```
/// Implementation block for Typical Builder
/// Implementation block for OrderedBuilderer