Reintroduce input for the node trait

# Conflicts:
#	node-graph/gcore/src/raster.rs
This commit is contained in:
Dennis
2022-08-10 13:05:57 +02:00
committed by Keavon Chambers
parent b46bcc16ba
commit ef08c27e9c
6 changed files with 79 additions and 34 deletions

View File

@@ -1,8 +1,10 @@
pub mod value;
pub use graphene_core::{generic, ops /*, structural*/};
#[cfg(feature = "memoization")]
pub mod memo;
//#[cfg(feature = "memoization")]
//pub mod memo;
//pub mod raster;
pub use graphene_core::*;

View File

@@ -0,0 +1,18 @@
use core::marker::PhantomData;
use graphene_core::{value::RefNode, value::ValueNode, Node};
pub struct MapNode<'n, IN: Node<'n, Output = I>, I: Iterator<Item = &'n S>, MAP: Fn(&dyn RefNode<Output = S>) -> MN, MN: Node<'n, Output = O> + 'n, S, O: 'n>(pub IN, pub MAP, PhantomData<&'n (I, S)>);
impl<'n, IN: Node<'n, Output = I>, I: Iterator<Item = &'n S>, MAP: Fn(&dyn RefNode<Output = S>) -> MN, MN: Node<'n, Output = O>, S, O: 'static + Clone> Node<'n> for MapNode<'n, IN, I, MAP, MN, S, O> {
type Output = Vec<O>;
fn eval(&'n self) -> Self::Output {
self.0
.eval()
.map(|x| {
let map_node = self.1(x as &dyn RefNode<Output = S>);
let result = map_node.eval();
result.clone()
})
.collect()
}
}