mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2026-01-16 08:33:06 +01:00
prowocessing: add documentation of trait experiment
This commit is contained in:
parent
98f6af78be
commit
0ebfed66ed
9 changed files with 93 additions and 37 deletions
|
|
@ -1,29 +1,38 @@
|
|||
use super::raw::{Data, OwnedData};
|
||||
|
||||
/// Newtype struct with borrowed types for pipeline/element inputs, so that doesn't force a move or clone
|
||||
pub struct Inputs<'a>(Vec<Data<'a>>);
|
||||
|
||||
impl<'a> Inputs<'a> {
|
||||
/// get inner value(s)
|
||||
pub(crate) fn inner(&self) -> Vec<Data<'a>> {
|
||||
self.0.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<Vec<Data<'a>>> for Inputs<'a> {
|
||||
fn from(value: Vec<Data<'a>>) -> Self {
|
||||
Self(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Into<Data<'a>>> From<T> for Inputs<'a> {
|
||||
fn from(value: T) -> Self {
|
||||
Self(vec![value.into()])
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a Outputs> for Inputs<'a> {
|
||||
fn from(value: &'a Outputs) -> Self {
|
||||
Self(value.0.iter().map(std::convert::Into::into).collect())
|
||||
}
|
||||
}
|
||||
|
||||
/// Newtype struct around `OwnedData` for pipeline/element outputs
|
||||
pub struct Outputs(Vec<OwnedData>);
|
||||
|
||||
impl Outputs {
|
||||
/// consume self and return inner value(s)
|
||||
pub fn into_inner(self) -> Vec<OwnedData> {
|
||||
self.0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue