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
//! Mapping from compile-time data types to run-time data types.
use crate::;
/// Data types that filters operate on.
///
/// Types that implement this trait allow to specify which data types a filter processes.
/// In particular, this allows native filters to operate on data types that
/// *may live only as long as the filter is executed*.
/// For example, this is required by the `inputs` filter,
/// whose global data --- namely the inputs to the main filter --- has a lifetime.
///
/// ## Motivation
///
/// If we have data types that are tied to a particular lifetime and
/// we would bake those data types into a native filter type,
/// then native filters could *only be used for data of this particular lifetime*.
/// For example, suppose that a filter operating on a value type `&'a str`
/// would have the type `Filter<&'a str>`.
/// The crucial point is that here, the `'a` is fixed,
/// so we could only run the filter with `&'a str` for one particular `'a`.
/// That would mean that if we want to execute the same filter with
/// data having different `'a` lifetimes
/// (e.g. for strings coming from different files),
/// we would need to recompile the filter every time (i.e. for every file).
///
/// This trait allows us to avoid this problem by separating the actual data from
/// the *knowledge* that a filter will operate on certain type of data.
/// That allows us to run a filter using data types with a lifetime that
/// depend on the lifetime of the filter execution.
/// Types that provide an `'a`-lived LUT for the data types given in `D`.
/// Filters that process `V` and take only LUT as data.
///
/// This restricts `V` to have a `'static` lifetime.
/// If you want to process `V` with arbitrary lifetimes instead,
/// you need to define your own data kind and implement [`DataT`] for it.
///
/// This type is mostly used for testing.
;