tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 709HTML 662Markdown 12TOML 62348 Sutichaykuna

Fix swift bindings

76649a5453a9c2c59215e598d5d7726e493b3477 · ruwaq David Flemström · (6 wata ñawpaq) · tayta 6f196156e · kay commitpi sach'ata qhaway

Semántico sayk'uy · 2

bindings/swift/StretchCore/src/lib.rs

2 qillqakuna · +5 −5

diff --git a/bindings/swift/StretchCore/Cargo.toml b/bindings/swift/StretchCore/Cargo.toml
index 0e0b10856..869e1ba01 100644
--- a/bindings/swift/StretchCore/Cargo.toml
+++ b/bindings/swift/StretchCore/Cargo.toml
@@ -5,7 +5,7 @@ authors = ["Emil Sjölander <emil@visly.app>"]
 edition = "2018"
 
 [dependencies]
-stretch = "0.3.2"
+stretch = { version = "0.3.2", path = "../../.." }
 
 [lib]
 name = "stretch"
diff --git a/bindings/swift/StretchCore/src/lib.rs b/bindings/swift/StretchCore/src/lib.rs
index f7f51d703..4b6811df2 100644
--- a/bindings/swift/StretchCore/src/lib.rs
+++ b/bindings/swift/StretchCore/src/lib.rs
@@ -214,7 +214,7 @@ pub unsafe extern "C" fn stretch_free(stretch: *mut c_void) {
 pub unsafe extern "C" fn stretch_node_create(stretch: *mut c_void, style: *mut c_void) -> *mut c_void {
     let mut stretch = Box::from_raw(stretch as *mut Stretch);
     let style = Box::from_raw(style as *mut Style);
-    let node = stretch.new_node(*style, vec![]).unwrap();
+    let node = stretch.new_node(*style, &[]).unwrap();
 
     Box::leak(style);
     Box::leak(stretch);
@@ -245,10 +245,10 @@ pub unsafe extern "C" fn stretch_node_set_measure(
     stretch
         .set_measure(
             *node,
-            Some(Box::new(move |constraint| {
+            Some(stretch::node::MeasureFunc::Boxed(Box::new(move |constraint| {
                 let size = measure(swift_ptr, constraint.width.or_else(f32::NAN), constraint.height.or_else(f32::NAN));
-                Ok(Size { width: size.width, height: size.height })
-            })),
+                Size { width: size.width, height: size.height }
+            }))),
         )
         .unwrap();