@@ -250,11 +250,11 @@ pub unsafe extern "C" fn Java_app_visly_stretch_Node_nConstruct(
250250 let mut buff = vec ! [ 0 ; num_children as usize ] ;
251251 env. get_long_array_region ( children, 0 , & mut buff) . unwrap ( ) ;
252252
253- let children = buff. into_iter ( ) . map ( |ptr| * Box :: leak ( Box :: from_raw ( ptr as * mut Node ) ) ) . collect ( ) ;
253+ let children = buff. into_iter ( ) . map ( |ptr| * Box :: leak ( Box :: from_raw ( ptr as * mut Node ) ) ) . collect :: < Vec < _ > > ( ) ;
254254
255255 let mut stretch = Box :: from_raw ( stretch as * mut Stretch ) ;
256256 let style = Box :: from_raw ( style as * mut Style ) ;
257- let node = stretch. new_node ( * style, children) . unwrap ( ) ;
257+ let node = stretch. new_node ( * style, & children) . unwrap ( ) ;
258258
259259 Box :: leak ( stretch) ;
260260 Box :: leak ( style) ;
@@ -277,7 +277,7 @@ pub unsafe extern "C" fn Java_app_visly_stretch_Node_nConstructLeaf(
277277 let node = stretch
278278 . new_leaf (
279279 * style,
280- Box :: new ( move |constraint| {
280+ stretch :: node :: MeasureFunc :: Boxed ( Box :: new ( move |constraint| {
281281 let result = env. call_method (
282282 measure. as_obj ( ) ,
283283 "measure" ,
@@ -293,11 +293,11 @@ pub unsafe extern "C" fn Java_app_visly_stretch_Node_nConstructLeaf(
293293 let size = result. l ( ) . unwrap ( ) . into_inner ( ) as jfloatArray ;
294294 let mut buff: [ f32 ; 2 ] = [ 0.0 , 0.0 ] ;
295295 env. get_float_array_region ( size, 0 , & mut buff) . unwrap ( ) ;
296- Ok ( Size { width : buff[ 0 ] , height : buff[ 1 ] } )
296+ Size { width : buff[ 0 ] , height : buff[ 1 ] }
297297 }
298- Err ( err ) => Err ( Box :: new ( err ) ) ,
298+ Err ( _ ) => constraint . map ( |v| v . or_else ( 0.0 ) ) ,
299299 }
300- } ) ,
300+ } ) ) ,
301301 )
302302 . unwrap ( ) ;
303303
@@ -332,7 +332,7 @@ pub unsafe extern "C" fn Java_app_visly_stretch_Node_nSetMeasure(
332332 stretch
333333 . set_measure (
334334 * node,
335- Some ( Box :: new ( move |constraint| {
335+ Some ( stretch :: node :: MeasureFunc :: Boxed ( Box :: new ( move |constraint| {
336336 let result = env. call_method (
337337 measure. as_obj ( ) ,
338338 "measure" ,
@@ -348,11 +348,11 @@ pub unsafe extern "C" fn Java_app_visly_stretch_Node_nSetMeasure(
348348 let size = result. l ( ) . unwrap ( ) . into_inner ( ) as jfloatArray ;
349349 let mut buff: [ f32 ; 2 ] = [ 0.0 , 0.0 ] ;
350350 env. get_float_array_region ( size, 0 , & mut buff) . unwrap ( ) ;
351- Ok ( Size { width : buff[ 0 ] , height : buff[ 1 ] } )
351+ Size { width : buff[ 0 ] , height : buff[ 1 ] }
352352 }
353- Err ( err ) => Err ( Box :: new ( err ) ) ,
353+ Err ( _ ) => constraint . map ( |v| v . or_else ( 0.0 ) ) ,
354354 }
355- } ) ) ,
355+ } ) ) ) ,
356356 )
357357 . unwrap ( ) ;
358358
@@ -419,11 +419,11 @@ pub unsafe extern "C" fn Java_app_visly_stretch_Node_nSetChildren(
419419 let mut buff = vec ! [ 0 ; num_children as usize ] ;
420420 env. get_long_array_region ( children, 0 , & mut buff) . unwrap ( ) ;
421421
422- let children = buff. into_iter ( ) . map ( |ptr| * Box :: leak ( Box :: from_raw ( ptr as * mut Node ) ) ) . collect ( ) ;
422+ let children = buff. into_iter ( ) . map ( |ptr| * Box :: leak ( Box :: from_raw ( ptr as * mut Node ) ) ) . collect :: < Vec < _ > > ( ) ;
423423
424424 let mut stretch = Box :: from_raw ( stretch as * mut Stretch ) ;
425425 let node = Box :: from_raw ( node as * mut Node ) ;
426- stretch. set_children ( * node, children) . unwrap ( ) ;
426+ stretch. set_children ( * node, & children) . unwrap ( ) ;
427427
428428 Box :: leak ( node) ;
429429 Box :: leak ( stretch) ;
0 commit comments