rustledger_plugin/native/plugins/
pedantic.rs1use crate::types::{PluginInput, PluginOutput};
4
5use super::super::NativePlugin;
6use super::check_commodity::CheckCommodityPlugin;
7use super::leaf_only::LeafOnlyPlugin;
8use super::no_duplicates::NoDuplicatesPlugin;
9use super::one_commodity::OneCommodityPlugin;
10
11pub struct PedanticPlugin;
19
20impl NativePlugin for PedanticPlugin {
21 fn name(&self) -> &'static str {
22 "pedantic"
23 }
24
25 fn description(&self) -> &'static str {
26 "Enable all strict validation rules"
27 }
28
29 fn process(&self, input: PluginInput) -> PluginOutput {
30 let mut all_errors = Vec::new();
31
32 let leafonly = LeafOnlyPlugin;
34 let result = leafonly.process(PluginInput {
35 directives: input.directives.clone(),
36 options: input.options.clone(),
37 config: None,
38 });
39 all_errors.extend(result.errors);
40
41 let onecommodity = OneCommodityPlugin;
43 let result = onecommodity.process(PluginInput {
44 directives: input.directives.clone(),
45 options: input.options.clone(),
46 config: None,
47 });
48 all_errors.extend(result.errors);
49
50 let noduplicates = NoDuplicatesPlugin;
52 let result = noduplicates.process(PluginInput {
53 directives: input.directives.clone(),
54 options: input.options.clone(),
55 config: None,
56 });
57 all_errors.extend(result.errors);
58
59 let check_commodity = CheckCommodityPlugin;
61 let result = check_commodity.process(PluginInput {
62 directives: input.directives.clone(),
63 options: input.options.clone(),
64 config: None,
65 });
66 all_errors.extend(result.errors);
67
68 PluginOutput {
69 directives: input.directives,
70 errors: all_errors,
71 }
72 }
73}