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
//! # Extensions for the customizability on usage of Step.
//!
//! Optional enhancements that add runtime flexibility to static pipelines.
//!
//! ## Conditional Decorators
//! The `DecoratorExt` trait provides some extensions that make the world easier
//! ### `.when()`
//! allowing decorators to be conditionally applied based on input predicates. This maintains the
//! zero-cost property - conditions are evaluated inline without dynamic dispatch.
//!
//! The condition check becomes part of the generated machine code, with no
//! additional abstraction layers.
//!
//! ```rust
//! // The pipeline will never be executed due to the invalidity of the condition passed in.
//! let builder = Builder {val: 2}
//! .step(ConditionalLongProcessing.when(|_| false));
//! ```
//!
use crateResult;
use crateDecorator;
/// Special decorator for validating upon advent of predicate
/// A trait extends the optional validation on the decorator being declared
///
/// It's the extension so the usage of it falls entirely on your hands. Once, you have imported this trait
/// any registered decorators can only take effect if the condition applies to it evaluated to True