mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 14:58:05 +08:00
committed by
Keavon Chambers
parent
1d6c4f13dd
commit
76c754d38a
@@ -5,7 +5,7 @@ pub struct FnNode<T: Fn(I) -> O, I, O>(T, PhantomData<(I, O)>);
|
||||
|
||||
impl<'i, T: Fn(I) -> O + 'i, O: 'i, I: 'i> Node<'i, I> for FnNode<T, I, O> {
|
||||
type Output = O;
|
||||
fn eval<'s: 'i>(&'s self, input: I) -> Self::Output {
|
||||
fn eval(&'i self, input: I) -> Self::Output {
|
||||
self.0(input)
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,11 @@ impl<T: Fn(I) -> O, I, O> FnNode<T, I, O> {
|
||||
pub struct FnNodeWithState<'i, T: Fn(I, &'i State) -> O, I, O, State: 'i>(T, State, PhantomData<(&'i O, I)>);
|
||||
impl<'i, I: 'i, O: 'i, State, T: Fn(I, &'i State) -> O + 'i> Node<'i, I> for FnNodeWithState<'i, T, I, O, State> {
|
||||
type Output = O;
|
||||
fn eval<'s: 'i>(&'s self, input: I) -> Self::Output {
|
||||
fn eval(&'i self, input: I) -> Self::Output {
|
||||
(self.0)(input, &self.1)
|
||||
}
|
||||
}
|
||||
impl<'i, 's: 'i, I, O, State, T: Fn(I, &'i State) -> O> FnNodeWithState<'i, T, I, O, State> {
|
||||
impl<'i, I, O, State, T: Fn(I, &'i State) -> O> FnNodeWithState<'i, T, I, O, State> {
|
||||
pub fn new(f: T, state: State) -> Self {
|
||||
FnNodeWithState(f, state, PhantomData)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user