mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Reintroduce input for the node trait
# Conflicts: # node-graph/gcore/src/raster.rs
This commit is contained in:
@@ -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::*;
|
||||
|
||||
|
||||
18
node-graph/gstd/src/raster.rs
Normal file
18
node-graph/gstd/src/raster.rs
Normal 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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user