mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2024-12-11 21:45:53 +01:00
experimentation: implement some basic traits for io and data types
This commit is contained in:
parent
31a044577a
commit
0705702d4a
2 changed files with 4 additions and 2 deletions
|
@ -5,6 +5,7 @@ use std::{borrow::ToOwned, convert::Into};
|
|||
use super::raw::Data;
|
||||
|
||||
/// Newtype struct with borrowed types for pipeline/element inputs, so that doesn't force a move or clone
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub struct Inputs<'a>(pub Vec<&'a Data>);
|
||||
|
||||
impl<'a> From<Vec<&'a Data>> for Inputs<'a> {
|
||||
|
@ -26,7 +27,8 @@ impl<'a> From<&'a Outputs> for Inputs<'a> {
|
|||
}
|
||||
|
||||
/// Used for pipeline/element outputs
|
||||
pub struct Outputs(Vec<Data>);
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub struct Outputs(pub Vec<Data>);
|
||||
|
||||
impl Outputs {
|
||||
/// consume self and return inner value(s)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Dynamic data storage and transfer types for use in [`io`]
|
||||
|
||||
// Dynamic data type
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum Data {
|
||||
String(String),
|
||||
Int(i32),
|
||||
|
|
Loading…
Reference in a new issue