experimentation: implement some basic traits for io and data types

This commit is contained in:
Schrottkatze 2024-02-27 13:13:18 +01:00
parent 4bc84451e0
commit 062138337c
Signed by: schrottkatze
SSH key fingerprint: SHA256:hXb3t1vINBFCiDCmhRABHX5ocdbLiKyCdKI4HK2Rbbc
2 changed files with 4 additions and 2 deletions

View file

@ -5,6 +5,7 @@ use std::{borrow::ToOwned, convert::Into};
use super::raw::Data; use super::raw::Data;
/// Newtype struct with borrowed types for pipeline/element inputs, so that doesn't force a move or clone /// 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>); pub struct Inputs<'a>(pub Vec<&'a Data>);
impl<'a> From<Vec<&'a Data>> for Inputs<'a> { 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 /// Used for pipeline/element outputs
pub struct Outputs(Vec<Data>); #[derive(PartialEq, Eq, Debug)]
pub struct Outputs(pub Vec<Data>);
impl Outputs { impl Outputs {
/// consume self and return inner value(s) /// consume self and return inner value(s)

View file

@ -1,7 +1,7 @@
//! Dynamic data storage and transfer types for use in [`io`] //! Dynamic data storage and transfer types for use in [`io`]
// Dynamic data type // Dynamic data type
#[derive(Clone, Debug)] #[derive(Clone, Debug, PartialEq, Eq)]
pub enum Data { pub enum Data {
String(String), String(String),
Int(i32), Int(i32),