rskit_dataset/validate.rs
1//! Pluggable per-item validation seam for the collection engine.
2//!
3//! The engine treats validation as an injected policy:
4//! a [`Validator`] inspects each item after its transforms and rejects it with a typed error.
5//! The engine ships no built-in validator —
6//! callers opt in (for example a schema-backed validator for tabular records).
7
8use rskit_errors::AppResult;
9
10use crate::DatasetItem;
11
12/// Rejects invalid items before they are materialized by a sink.
13pub trait Validator<T: DatasetItem>: Send + Sync {
14 /// Return an error when `item` fails validation; `Ok(())` accepts it.
15 fn validate(&self, item: &T) -> AppResult<()>;
16}