Debian Codegraph @

intl/icu_capi/bindings/js/ICU4XPropertyValueNameToEnumMapper.mjs

raw
1 import wasm from "./diplomat-wasm.mjs"
2 import * as diplomatRuntime from "./diplomat-runtime.mjs"
3 import { ICU4XError_js_to_rust, ICU4XError_rust_to_js } from "./ICU4XError.mjs"
4
5 const ICU4XPropertyValueNameToEnumMapper_box_destroy_registry = new FinalizationRegistry(underlying => {
6 wasm.ICU4XPropertyValueNameToEnumMapper_destroy(underlying);
7 });
8
9 export class ICU4XPropertyValueNameToEnumMapper {
10 #lifetimeEdges = [];
11 constructor(underlying, owned, edges) {
12 this.underlying = underlying;
13 this.#lifetimeEdges.push(...edges);
14 if (owned) {
15 ICU4XPropertyValueNameToEnumMapper_box_destroy_registry.register(this, underlying);
16 }
17 }
18
19 get_strict(arg_name) {
20 const buf_arg_name = diplomatRuntime.DiplomatBuf.str8(wasm, arg_name);
21 const diplomat_out = wasm.ICU4XPropertyValueNameToEnumMapper_get_strict(this.underlying, buf_arg_name.ptr, buf_arg_name.size);
22 buf_arg_name.free();
23 return diplomat_out;
24 }
25
26 get_loose(arg_name) {
27 const buf_arg_name = diplomatRuntime.DiplomatBuf.str8(wasm, arg_name);
28 const diplomat_out = wasm.ICU4XPropertyValueNameToEnumMapper_get_loose(this.underlying, buf_arg_name.ptr, buf_arg_name.size);
29 buf_arg_name.free();
30 return diplomat_out;
31 }
32
33 static load_general_category(arg_provider) {
34 return (() => {
35 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
36 wasm.ICU4XPropertyValueNameToEnumMapper_load_general_category(diplomat_receive_buffer, arg_provider.underlying);
37 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
38 if (is_ok) {
39 const ok_value = new ICU4XPropertyValueNameToEnumMapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
40 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
41 return ok_value;
42 } else {
43 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
44 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
45 throw new diplomatRuntime.FFIError(throw_value);
46 }
47 })();
48 }
49
50 static load_hangul_syllable_type(arg_provider) {
51 return (() => {
52 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
53 wasm.ICU4XPropertyValueNameToEnumMapper_load_hangul_syllable_type(diplomat_receive_buffer, arg_provider.underlying);
54 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
55 if (is_ok) {
56 const ok_value = new ICU4XPropertyValueNameToEnumMapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
57 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
58 return ok_value;
59 } else {
60 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
61 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
62 throw new diplomatRuntime.FFIError(throw_value);
63 }
64 })();
65 }
66
67 static load_east_asian_width(arg_provider) {
68 return (() => {
69 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
70 wasm.ICU4XPropertyValueNameToEnumMapper_load_east_asian_width(diplomat_receive_buffer, arg_provider.underlying);
71 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
72 if (is_ok) {
73 const ok_value = new ICU4XPropertyValueNameToEnumMapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
74 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
75 return ok_value;
76 } else {
77 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
78 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
79 throw new diplomatRuntime.FFIError(throw_value);
80 }
81 })();
82 }
83
84 static load_bidi_class(arg_provider) {
85 return (() => {
86 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
87 wasm.ICU4XPropertyValueNameToEnumMapper_load_bidi_class(diplomat_receive_buffer, arg_provider.underlying);
88 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
89 if (is_ok) {
90 const ok_value = new ICU4XPropertyValueNameToEnumMapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
91 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
92 return ok_value;
93 } else {
94 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
95 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
96 throw new diplomatRuntime.FFIError(throw_value);
97 }
98 })();
99 }
100
101 static load_indic_syllabic_category(arg_provider) {
102 return (() => {
103 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
104 wasm.ICU4XPropertyValueNameToEnumMapper_load_indic_syllabic_category(diplomat_receive_buffer, arg_provider.underlying);
105 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
106 if (is_ok) {
107 const ok_value = new ICU4XPropertyValueNameToEnumMapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
108 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
109 return ok_value;
110 } else {
111 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
112 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
113 throw new diplomatRuntime.FFIError(throw_value);
114 }
115 })();
116 }
117
118 static load_line_break(arg_provider) {
119 return (() => {
120 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
121 wasm.ICU4XPropertyValueNameToEnumMapper_load_line_break(diplomat_receive_buffer, arg_provider.underlying);
122 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
123 if (is_ok) {
124 const ok_value = new ICU4XPropertyValueNameToEnumMapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
125 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
126 return ok_value;
127 } else {
128 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
129 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
130 throw new diplomatRuntime.FFIError(throw_value);
131 }
132 })();
133 }
134
135 static load_grapheme_cluster_break(arg_provider) {
136 return (() => {
137 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
138 wasm.ICU4XPropertyValueNameToEnumMapper_load_grapheme_cluster_break(diplomat_receive_buffer, arg_provider.underlying);
139 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
140 if (is_ok) {
141 const ok_value = new ICU4XPropertyValueNameToEnumMapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
142 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
143 return ok_value;
144 } else {
145 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
146 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
147 throw new diplomatRuntime.FFIError(throw_value);
148 }
149 })();
150 }
151
152 static load_word_break(arg_provider) {
153 return (() => {
154 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
155 wasm.ICU4XPropertyValueNameToEnumMapper_load_word_break(diplomat_receive_buffer, arg_provider.underlying);
156 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
157 if (is_ok) {
158 const ok_value = new ICU4XPropertyValueNameToEnumMapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
159 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
160 return ok_value;
161 } else {
162 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
163 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
164 throw new diplomatRuntime.FFIError(throw_value);
165 }
166 })();
167 }
168
169 static load_sentence_break(arg_provider) {
170 return (() => {
171 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
172 wasm.ICU4XPropertyValueNameToEnumMapper_load_sentence_break(diplomat_receive_buffer, arg_provider.underlying);
173 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
174 if (is_ok) {
175 const ok_value = new ICU4XPropertyValueNameToEnumMapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
176 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
177 return ok_value;
178 } else {
179 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
180 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
181 throw new diplomatRuntime.FFIError(throw_value);
182 }
183 })();
184 }
185
186 static load_script(arg_provider) {
187 return (() => {
188 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
189 wasm.ICU4XPropertyValueNameToEnumMapper_load_script(diplomat_receive_buffer, arg_provider.underlying);
190 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
191 if (is_ok) {
192 const ok_value = new ICU4XPropertyValueNameToEnumMapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
193 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
194 return ok_value;
195 } else {
196 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
197 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
198 throw new diplomatRuntime.FFIError(throw_value);
199 }
200 })();
201 }
202 }