6
6
7
7
8
8
9
+
10
+
11
+ typedef struct {
12
+ const int32_t * ptr ;
13
+ size_t len ;
14
+ size_t capacity ;
15
+ } blink_fuzzy__Vec_int32_t;
9
16
typedef struct {
10
17
const uint32_t * ptr ;
11
18
size_t len ;
@@ -16,13 +23,11 @@ typedef struct {
16
23
size_t len ;
17
24
size_t capacity ;
18
25
} blink_fuzzy__Vec___string_ptr;
19
-
20
-
21
- typedef struct {
22
- const int32_t * ptr ;
23
- size_t len ;
24
- size_t capacity ;
25
- } blink_fuzzy__Vec_int32_t;
26
+ int32_t init_db (
27
+ const char * ,
28
+ int8_t * );
29
+ int32_t __gc_init_db (
30
+ int8_t );
26
31
int32_t fuzzy (
27
32
const char * ,
28
33
const blink_fuzzy__Vec___string_ptr * ,
@@ -51,28 +56,11 @@ int32_t __gc_get_lines_words(
51
56
52
57
53
58
54
- local __const_c_typename___string_ptr = ffi .typeof (" const char *[?]" )
55
- local __c_function_argument___string_ptr = ffi .typeof (" const char *[?]" )
56
- local __c_mut_function_argument___string_ptr = ffi .typeof (" char *[?]" )
57
-
58
-
59
59
local __const_c_typename_uint32_t = ffi .typeof (" const uint32_t[?]" )
60
60
local __c_function_argument_uint32_t = ffi .typeof (" uint32_t[?]" )
61
61
local __c_mut_function_argument_uint32_t = ffi .typeof (" uint32_t[?]" )
62
62
63
63
64
- local __typename_Vec_uint32_t = ffi .metatype (" blink_fuzzy__Vec_uint32_t" , {})
65
- local __const_c_typename_Vec_uint32_t = ffi .typeof (" const blink_fuzzy__Vec_uint32_t[?]" )
66
- local __c_function_argument_Vec_uint32_t = ffi .typeof (" const blink_fuzzy__Vec_uint32_t*[?]" )
67
- local __c_mut_function_argument_Vec_uint32_t = ffi .typeof (" blink_fuzzy__Vec_uint32_t*[?]" )
68
-
69
-
70
- local __typename_Vec___string_ptr = ffi .metatype (" blink_fuzzy__Vec___string_ptr" , {})
71
- local __const_c_typename_Vec___string_ptr = ffi .typeof (" const blink_fuzzy__Vec___string_ptr[?]" )
72
- local __c_function_argument_Vec___string_ptr = ffi .typeof (" const blink_fuzzy__Vec___string_ptr*[?]" )
73
- local __c_mut_function_argument_Vec___string_ptr = ffi .typeof (" blink_fuzzy__Vec___string_ptr*[?]" )
74
-
75
-
76
64
local __const_c_typename_bool = ffi .typeof (" const int8_t[?]" )
77
65
local __c_function_argument_bool = ffi .typeof (" int8_t[?]" )
78
66
local __c_mut_function_argument_bool = ffi .typeof (" int8_t[?]" )
@@ -83,11 +71,45 @@ local __c_function_argument_int32_t = ffi.typeof("int32_t[?]")
83
71
local __c_mut_function_argument_int32_t = ffi .typeof (" int32_t[?]" )
84
72
85
73
74
+ local __const_c_typename___string_ptr = ffi .typeof (" const char *[?]" )
75
+ local __c_function_argument___string_ptr = ffi .typeof (" const char *[?]" )
76
+ local __c_mut_function_argument___string_ptr = ffi .typeof (" char *[?]" )
77
+
78
+
86
79
local __typename_Vec_int32_t = ffi .metatype (" blink_fuzzy__Vec_int32_t" , {})
87
80
local __const_c_typename_Vec_int32_t = ffi .typeof (" const blink_fuzzy__Vec_int32_t[?]" )
88
81
local __c_function_argument_Vec_int32_t = ffi .typeof (" const blink_fuzzy__Vec_int32_t*[?]" )
89
82
local __c_mut_function_argument_Vec_int32_t = ffi .typeof (" blink_fuzzy__Vec_int32_t*[?]" )
90
83
84
+
85
+ local __typename_Vec_uint32_t = ffi .metatype (" blink_fuzzy__Vec_uint32_t" , {})
86
+ local __const_c_typename_Vec_uint32_t = ffi .typeof (" const blink_fuzzy__Vec_uint32_t[?]" )
87
+ local __c_function_argument_Vec_uint32_t = ffi .typeof (" const blink_fuzzy__Vec_uint32_t*[?]" )
88
+ local __c_mut_function_argument_Vec_uint32_t = ffi .typeof (" blink_fuzzy__Vec_uint32_t*[?]" )
89
+
90
+
91
+ local __typename_Vec___string_ptr = ffi .metatype (" blink_fuzzy__Vec___string_ptr" , {})
92
+ local __const_c_typename_Vec___string_ptr = ffi .typeof (" const blink_fuzzy__Vec___string_ptr[?]" )
93
+ local __c_function_argument_Vec___string_ptr = ffi .typeof (" const blink_fuzzy__Vec___string_ptr*[?]" )
94
+ local __c_mut_function_argument_Vec___string_ptr = ffi .typeof (" blink_fuzzy__Vec___string_ptr*[?]" )
95
+
96
+ function M .init_db (
97
+ db_path )
98
+ local __typeof = __c_mut_function_argument_bool
99
+ local __ret_ptr = __typeof (1 , {})
100
+ local status = rust .init_db (
101
+ (function (value ) return value end )(db_path ),
102
+ __ret_ptr
103
+ )
104
+ if status ~= 0 then
105
+ error (" init_db failed with status " .. status )
106
+ end
107
+ local __ret = __ret_ptr [0 ]
108
+
109
+ local f = function (value ) return value ~= 0 end
110
+ return f (__ret )
111
+ end
112
+
91
113
function M .fuzzy (
92
114
needle ,
93
115
haystack ,
0 commit comments