forked from katzen-cafe/iowo
prowocessing: add documentation of trait experiment
This commit is contained in:
parent
dddbcccf72
commit
734a734f09
9 changed files with 93 additions and 37 deletions
|
@ -1,3 +1,4 @@
|
|||
//! Operations on numeric data
|
||||
use core::panic;
|
||||
|
||||
use crate::experimental::trait_based::{
|
||||
|
@ -5,9 +6,10 @@ use crate::experimental::trait_based::{
|
|||
io::{Inputs, Outputs},
|
||||
raw::Data,
|
||||
},
|
||||
element::{DataType, ElementIo, PipelineElement},
|
||||
element::{DataType, ElementSignature, PipelineElement},
|
||||
};
|
||||
|
||||
/// Addition
|
||||
pub struct Add(pub i32);
|
||||
impl PipelineElement for Add {
|
||||
fn runner(&self) -> fn(&Inputs) -> Outputs {
|
||||
|
@ -20,14 +22,15 @@ impl PipelineElement for Add {
|
|||
}
|
||||
}
|
||||
|
||||
fn signature(&self) -> ElementIo {
|
||||
ElementIo {
|
||||
fn signature(&self) -> ElementSignature {
|
||||
ElementSignature {
|
||||
inputs: vec![DataType::Int, DataType::Int],
|
||||
outputs: vec![DataType::Int],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Subtraction
|
||||
pub struct Subtract(pub i32);
|
||||
impl PipelineElement for Subtract {
|
||||
fn runner(&self) -> fn(&Inputs) -> Outputs {
|
||||
|
@ -40,14 +43,15 @@ impl PipelineElement for Subtract {
|
|||
}
|
||||
}
|
||||
|
||||
fn signature(&self) -> ElementIo {
|
||||
ElementIo {
|
||||
fn signature(&self) -> ElementSignature {
|
||||
ElementSignature {
|
||||
inputs: vec![DataType::Int, DataType::Int],
|
||||
outputs: vec![DataType::Int],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Turn input to string
|
||||
pub struct Stringify;
|
||||
impl PipelineElement for Stringify {
|
||||
fn runner(&self) -> fn(&Inputs) -> Outputs {
|
||||
|
@ -60,8 +64,8 @@ impl PipelineElement for Stringify {
|
|||
}
|
||||
}
|
||||
|
||||
fn signature(&self) -> ElementIo {
|
||||
ElementIo {
|
||||
fn signature(&self) -> ElementSignature {
|
||||
ElementSignature {
|
||||
inputs: vec![DataType::Int],
|
||||
outputs: vec![DataType::String],
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue