Skip to main content

rskit_dataset/
validate.rs

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