@@ -160,14 +160,17 @@ where
160
160
N : Node < ' i , T , Output : WasmNotSend > + WasmNotSend ,
161
161
{
162
162
type Output = DynFuture < ' i , N :: Output > ;
163
+ #[ inline( always) ]
163
164
fn eval ( & ' i self , input : T ) -> Self :: Output {
164
165
let result = self . node . eval ( input) ;
165
166
Box :: pin ( async move { result } )
166
167
}
168
+ #[ inline( always) ]
167
169
fn reset ( & self ) {
168
170
self . node . reset ( ) ;
169
171
}
170
172
173
+ #[ inline( always) ]
171
174
fn serialize ( & self ) -> Option < std:: sync:: Arc < dyn core:: any:: Any > > {
172
175
self . node . serialize ( )
173
176
}
@@ -231,37 +234,38 @@ where
231
234
}
232
235
}
233
236
237
+ async fn construct_vector2 < ' n , IY : Into < f64 > + Send + ' n , IC : Into < u64 > + Send + ' n > ( _: ( ) , x : f64 , y : IY , c : impl Node < ' n , ( ) , Output : core:: future:: Future < Output = IC > > ) -> glam:: DVec2 {
238
+ glam:: DVec2 :: new ( x, y. into ( ) )
239
+ }
234
240
mod construct_vector2 {
235
241
use super :: * ;
236
- use crate :: registry:: { DowncastBothNode , DynAnyNode , FieldMetadata , FutureWrapperNode , NodeMetadata , NODE_METADATA , NODE_REGISTRY } ;
237
- use crate :: { concrete, fn_type, Node , NodeIOTypes , ProtoNodeIdentifier } ;
238
- use core:: future:: Future ;
242
+ use crate as gcore;
239
243
use ctor:: ctor;
244
+ use gcore:: ops:: TypeNode ;
245
+ use gcore:: registry:: { DowncastBothNode , DynAnyNode , DynFuture , FieldMetadata , NodeMetadata , TypeErasedBox , NODE_METADATA , NODE_REGISTRY } ;
246
+ use gcore:: value:: ClonedNode ;
247
+ use gcore:: { concrete, fn_type, Node , NodeIOTypes , ProtoNodeIdentifier , WasmNotSync } ;
240
248
pub struct ConstructVector2 < Node0 , Node1 , Node2 > {
241
249
x : Node0 ,
242
250
y : Node1 ,
243
251
c : Node2 ,
244
252
}
245
- #[ allow( non_snake_case) ]
246
- async fn construct_vector2 < ' n , IY : Into < f64 > > ( _: ( ) , x : f64 , y : IY , c : impl Node < ' n , ( ) , Output : Future < Output = u32 > > ) -> glam:: DVec2 {
247
- glam:: DVec2 :: new ( x, y. into ( ) )
248
- }
249
- impl < ' n , IY : Into < f64 > , Node0 , Node1 , Node2 > Node < ' n , ( ) > for ConstructVector2 < Node0 , Node1 , Node2 >
253
+ #[ automatically_derived]
254
+ impl < ' n , IY : Into < f64 > + Send + ' n , IC : Into < u64 > + Send + ' n , Node0 , Node1 , Node2 > Node < ' n , ( ) > for ConstructVector2 < Node0 , Node1 , Node2 >
250
255
where
251
256
Node0 : Node < ' n , ( ) , Output = f64 > ,
252
257
Node1 : Node < ' n , ( ) , Output = IY > ,
253
- Node2 : Node < ' n , ( ) , Output : Future < Output = u32 > > ,
258
+ Node2 : Node < ' n , ( ) , Output : core :: future :: Future < Output = IC > > + WasmNotSync + ' n ,
254
259
{
255
- type Output = Pin < Box < dyn Future < Output = glam:: DVec2 > + ' n > > ;
260
+ type Output = DynFuture < ' n , glam:: DVec2 > ;
256
261
fn eval ( & ' n self , input : ( ) ) -> Self :: Output {
257
- Box :: pin ( async move {
258
- let x = self . x . eval ( ( ) ) ;
259
- let y = self . y . eval ( ( ) ) ;
260
- let c = & self . c ;
261
- construct_vector2 ( input, x, y, c) . await
262
- } )
262
+ let x = self . x . eval ( ( ) ) ;
263
+ let y = self . y . eval ( ( ) ) ;
264
+ let c = & self . c ;
265
+ Box :: pin ( construct_vector2 ( input, x, y, c) )
263
266
}
264
267
}
268
+ #[ automatically_derived]
265
269
impl < ' n , Node0 , Node1 , Node2 > ConstructVector2 < Node0 , Node1 , Node2 > {
266
270
pub fn new ( x : Node0 , y : Node1 , c : Node2 ) -> Self {
267
271
Self { x, y, c }
@@ -277,28 +281,40 @@ mod construct_vector2 {
277
281
|args| {
278
282
Box :: pin( async move {
279
283
let x: DowncastBothNode <( ) , f64 > = DowncastBothNode :: new( args[ 0usize ] . clone( ) ) ;
284
+ let value = x. eval( ( ) ) . await ;
285
+ let x = ClonedNode :: new( value) ;
286
+ let x: TypeNode <_, ( ) , f64 > = TypeNode :: new( x) ;
280
287
let y: DowncastBothNode <( ) , f32 > = DowncastBothNode :: new( args[ 1usize ] . clone( ) ) ;
288
+ let value = y. eval( ( ) ) . await ;
289
+ let y = ClonedNode :: new( value) ;
290
+ let y: TypeNode <_, ( ) , f32 > = TypeNode :: new( y) ;
281
291
let c: DowncastBothNode <( ) , u32 > = DowncastBothNode :: new( args[ 2usize ] . clone( ) ) ;
282
292
let node = ConstructVector2 :: new( x, y, c) ;
283
293
let any: DynAnyNode <( ) , _, _> = DynAnyNode :: new( node) ;
284
- any . into_type_erased ( )
294
+ Box :: new ( any ) as TypeErasedBox < ' _>
285
295
} )
286
296
} ,
287
- NodeIOTypes :: new( concrete!( ( ) ) , concrete!( glam:: DVec2 ) , vec![ fn_type!( ( ) , f64 ) , fn_type!( ( ) , f32 ) , fn_type!( ( ) , u32 ) , ] , )
288
- ) ;
297
+ NodeIOTypes :: new( concrete!( ( ) ) , concrete!( glam:: DVec2 ) , vec![ fn_type!( ( ) , f64 ) , fn_type!( ( ) , f32 ) , fn_type!( ( ) , u32 ) ] ) ,
298
+ ) ,
289
299
(
290
300
|args| {
291
301
Box :: pin( async move {
292
302
let x: DowncastBothNode <( ) , f64 > = DowncastBothNode :: new( args[ 0usize ] . clone( ) ) ;
303
+ let value = x. eval( ( ) ) . await ;
304
+ let x = ClonedNode :: new( value) ;
305
+ let x: TypeNode <_, ( ) , f64 > = TypeNode :: new( x) ;
293
306
let y: DowncastBothNode <( ) , f64 > = DowncastBothNode :: new( args[ 1usize ] . clone( ) ) ;
307
+ let value = y. eval( ( ) ) . await ;
308
+ let y = ClonedNode :: new( value) ;
309
+ let y: TypeNode <_, ( ) , f64 > = TypeNode :: new( y) ;
294
310
let c: DowncastBothNode <( ) , u64 > = DowncastBothNode :: new( args[ 2usize ] . clone( ) ) ;
295
311
let node = ConstructVector2 :: new( x, y, c) ;
296
312
let any: DynAnyNode <( ) , _, _> = DynAnyNode :: new( node) ;
297
- any . into_type_erased ( )
313
+ Box :: new ( any ) as TypeErasedBox < ' _>
298
314
} )
299
315
} ,
300
- NodeIOTypes :: new( concrete!( ( ) ) , concrete!( glam:: DVec2 ) , vec![ fn_type!( ( ) , f64 ) , fn_type!( ( ) , f64 ) , fn_type!( ( ) , u64 ) , ] , )
301
- )
316
+ NodeIOTypes :: new( concrete!( ( ) ) , concrete!( glam:: DVec2 ) , vec![ fn_type!( ( ) , f64 ) , fn_type!( ( ) , f64 ) , fn_type!( ( ) , u64 ) ] ) ,
317
+ ) ,
302
318
] ,
303
319
) ;
304
320
}
0 commit comments