pub trait Transform<T>: Send + Sync {
type Output;
// Required method
fn transform(&self, input: T) -> Result<Self::Output>;
// Provided methods
fn transform_batch(&self, inputs: Vec<T>) -> Result<Vec<Self::Output>> { ... }
fn is_deterministic(&self) -> bool { ... }
}Expand description
Trait for data transformations
This is the core abstraction for all data transformations in the ToRSh ecosystem. Implementations should be stateless where possible and thread-safe.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn transform_batch(&self, inputs: Vec<T>) -> Result<Vec<Self::Output>>
fn transform_batch(&self, inputs: Vec<T>) -> Result<Vec<Self::Output>>
Transform multiple items in batch
Default implementation applies transform individually, but implementations can override this for more efficient batch processing.
Sourcefn is_deterministic(&self) -> bool
fn is_deterministic(&self) -> bool
Check if the transform is deterministic
A deterministic transform always produces the same output for the same input. Non-deterministic transforms include random augmentations.