51 lines
1.2 KiB
Rust
51 lines
1.2 KiB
Rust
use super::raw::{Data, OwnedData};
|
|
|
|
pub struct Inputs<'a>(Vec<Data<'a>>);
|
|
impl<'a> Inputs<'a> {
|
|
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())
|
|
}
|
|
}
|
|
|
|
pub struct Outputs(Vec<OwnedData>);
|
|
impl Outputs {
|
|
pub fn into_inner(self) -> Vec<OwnedData> {
|
|
self.0
|
|
}
|
|
}
|
|
impl From<Vec<OwnedData>> for Outputs {
|
|
fn from(value: Vec<OwnedData>) -> Self {
|
|
Self(value)
|
|
}
|
|
}
|
|
impl<T: Into<OwnedData>> From<T> for Outputs {
|
|
fn from(value: T) -> Self {
|
|
Self(vec![value.into()])
|
|
}
|
|
}
|
|
impl From<Inputs<'_>> for Outputs {
|
|
fn from(value: Inputs) -> Self {
|
|
Self(
|
|
value
|
|
.0
|
|
.into_iter()
|
|
.map(|i: Data<'_>| Data::to_owned_data(&i))
|
|
.collect(),
|
|
)
|
|
}
|
|
}
|