File tree Expand file tree Collapse file tree 5 files changed +74
-27
lines changed Expand file tree Collapse file tree 5 files changed +74
-27
lines changed Original file line number Diff line number Diff line change 1
1
/* tslint:disable */
2
2
/* eslint-disable */
3
3
/**
4
- * @param {Point } point
5
- */
6
- export function consume ( point : Point ) : void ;
7
- /**
8
4
* @returns {Point }
9
5
*/
10
6
export function into_js ( ) : Point ;
11
- /**
12
- * @param {(Point)[] } points
13
- */
14
- export function consume_vector ( points : ( Point ) [ ] ) : void ;
15
- /**
16
- * @returns {(Point)[] }
17
- */
18
- export function vector_into_js ( ) : ( Point ) [ ] ;
19
7
export interface Point {
20
8
x : number ;
21
9
y : number ;
Original file line number Diff line number Diff line change
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * @param {Point } point
5
+ */
6
+ export function consume ( point : Point ) : void ;
7
+ /**
8
+ * @returns {Point }
9
+ */
10
+ export function into_js ( ) : Point ;
11
+ /**
12
+ * @param {(Point)[] } points
13
+ */
14
+ export function consume_vector ( points : ( Point ) [ ] ) : void ;
15
+ /**
16
+ * @returns {(Point)[] }
17
+ */
18
+ export function vector_into_js ( ) : ( Point ) [ ] ;
19
+ export interface Point {
20
+ x : number ;
21
+ y : number ;
22
+ }
23
+
Original file line number Diff line number Diff line change @@ -9,22 +9,7 @@ pub struct Point {
9
9
y : i32 ,
10
10
}
11
11
12
- #[ wasm_bindgen]
13
- pub fn consume ( point : Point ) { }
14
-
15
12
#[ wasm_bindgen]
16
13
pub fn into_js ( ) -> Point {
17
14
Point { x : 0 , y : 0 }
18
15
}
19
-
20
- #[ wasm_bindgen]
21
- pub fn consume_vector ( points : Vec < Point > ) { }
22
-
23
- #[ wasm_bindgen]
24
- pub fn vector_into_js ( ) -> Vec < Point > {
25
- vec ! [
26
- Point { x: 1 , y: 6 } ,
27
- Point { x: 2 , y: 5 } ,
28
- Point { x: 3 , y: 4 } ,
29
- ]
30
- }
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " test4"
3
+ publish = false
4
+ version = " 0.1.0"
5
+ edition = " 2021"
6
+
7
+ [dependencies ]
8
+ wasm-bindgen = " 0.2"
9
+ tsify-next = { path = " ../.." , version = " *" }
10
+ serde = { version = " 1.0" , features = [" derive" ] }
11
+ serde_json = " 1.0"
12
+
13
+ [dev-dependencies ]
14
+ wasm-bindgen-test = " 0.3"
15
+
16
+ [lib ]
17
+ path = " entry_point.rs"
18
+ crate-type = [" cdylib" ]
19
+
20
+ [build-dependencies ]
21
+ wasm-bindgen-cli = " 0.2"
Original file line number Diff line number Diff line change
1
+ use serde:: { Deserialize , Serialize } ;
2
+ use tsify_next:: Tsify ;
3
+ use wasm_bindgen:: prelude:: * ;
4
+
5
+ #[ derive( Tsify , Serialize , Deserialize ) ]
6
+ #[ tsify( into_wasm_abi, from_wasm_abi) ]
7
+ pub struct Point {
8
+ x : i32 ,
9
+ y : i32 ,
10
+ }
11
+
12
+ #[ wasm_bindgen]
13
+ pub fn consume ( point : Point ) { }
14
+
15
+ #[ wasm_bindgen]
16
+ pub fn into_js ( ) -> Point {
17
+ Point { x : 0 , y : 0 }
18
+ }
19
+
20
+ #[ wasm_bindgen]
21
+ pub fn consume_vector ( points : Vec < Point > ) { }
22
+
23
+ #[ wasm_bindgen]
24
+ pub fn vector_into_js ( ) -> Vec < Point > {
25
+ vec ! [
26
+ Point { x: 1 , y: 6 } ,
27
+ Point { x: 2 , y: 5 } ,
28
+ Point { x: 3 , y: 4 } ,
29
+ ]
30
+ }
You can’t perform that action at this time.
0 commit comments