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
//! Validator processor (#146).
//!
//! Validation failure is represented through the framework's typed
//! [`ProcessorError`] failure model, never a panic and never silent
//! filtering: an invalid item is a processor failure, exactly like any other
//! typed processor error, and participates in the same fault/skip machinery.
use PhantomData;
use crate::;
/// A synchronous validation rule over a borrowed item.
///
/// Blanket-implemented for `Fn(&I) -> Result<(), ProcessorError> + Send +
/// Sync` closures, so most callers never name this trait.
/// A [`crate::ItemProcessor`] that validates its input and passes it through
/// unchanged when valid.
///
/// Compose validation with a transform by chaining
/// [`crate::item_components::ChainProcessor`] after this processor rather
/// than folding both concerns into one type.
///
/// # Contract
///
/// - **Input/output**: `I -> I`; unchanged when valid.
/// - **State/checkpoint**: stateless.
/// - **Ordering**: preserves order; never filters (an invalid item fails the
/// chunk attempt rather than being silently dropped).
/// - **Thread safety**: `Send + Sync` whenever `V: Send + Sync`.
/// - **Reentrancy**: fully reentrant when the validator is.
/// - **Transaction/delivery**: not applicable.
/// - **Bounded resource**: clones one item per call.
/// - **Cancellation**: honors the call-scoped stop token, checked before
/// validation runs.
/// - **Close**: nothing to close.
/// - **Sensitive diagnostics**: [`ProcessorError`] redacts any payload the
/// validator's closure captured; do not format the item into the error.
/// - **Malformed input**: an invalid item returns [`ProcessorError`], which
/// the framework's typed fault/skip machinery classifies exactly like any
/// other processor failure.
/// - **Support tier**: first-party.
/// - **Evidence**: `crates/oxide-batch-test/tests/item_components_basic.rs`.