Skip to main content

scratch_test_model/aux/
do_for_attrs.rs

1pub trait DoForAttrsStrategy<'a> {
2    type Inputs;
3    type Outputs;
4    type Error;
5}
6
7/// This trait is implemented for all blocks.
8///
9/// For blocks a generic implementation will call [`DoForAttrs::do_for_attrs`]
10/// for all attributes of the block variant at hand in the order they
11/// stand in the source file.
12/// Every attribute may modify the value of `outputs`.
13///
14/// For every kind of traversal the trait needs to be implemented for all attribute types.
15/// That are many but it is easier than implementing
16/// it for all occurences of an attribute in block variants separately.
17pub trait DoForAttrs<'a, S: DoForAttrsStrategy<'a>> {
18    fn do_for_attrs(&'a self, inputs: &S::Inputs, outputs: &mut S::Outputs)
19    -> Result<(), S::Error>;
20}