prowocessing: add documentation of trait experiment

This commit is contained in:
Schrottkatze 2024-02-21 14:24:57 +01:00
commit 0ebfed66ed
No known key found for this signature in database
9 changed files with 93 additions and 37 deletions

View file

@ -1,17 +1,23 @@
//! The trait and type representations
use crate::experimental::trait_based::data::io::Inputs;
use super::data::io::Outputs;
pub(crate) trait PipelineElement {
/// return a static runner function pointer to avoid dynamic dispatch during pipeline execution - Types MUST match the signature
fn runner(&self) -> fn(&Inputs) -> Outputs;
fn signature(&self) -> ElementIo;
/// return the signature of the element
fn signature(&self) -> ElementSignature;
}
pub(crate) struct ElementIo {
/// Type signature for an element used for static checking
pub(crate) struct ElementSignature {
pub inputs: Vec<DataType>,
pub outputs: Vec<DataType>,
}
/// Data type enum
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum DataType {
String,