CodePointSetBuilder.mjs (9268B)
1 // generated by diplomat-tool 2 import { CodePointSetData } from "./CodePointSetData.mjs" 3 import wasm from "./diplomat-wasm.mjs"; 4 import * as diplomatRuntime from "./diplomat-runtime.mjs"; 5 6 7 /** 8 * See the [Rust documentation for `CodePointInversionListBuilder`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html) for more information. 9 */ 10 const CodePointSetBuilder_box_destroy_registry = new FinalizationRegistry((ptr) => { 11 wasm.icu4x_CodePointSetBuilder_destroy_mv1(ptr); 12 }); 13 14 export class CodePointSetBuilder { 15 // Internal ptr reference: 16 #ptr = null; 17 18 // Lifetimes are only to keep dependencies alive. 19 // Since JS won't garbage collect until there are no incoming edges. 20 #selfEdge = []; 21 22 #internalConstructor(symbol, ptr, selfEdge) { 23 if (symbol !== diplomatRuntime.internalConstructor) { 24 console.error("CodePointSetBuilder is an Opaque type. You cannot call its constructor."); 25 return; 26 } 27 this.#ptr = ptr; 28 this.#selfEdge = selfEdge; 29 30 // Are we being borrowed? If not, we can register. 31 if (this.#selfEdge.length === 0) { 32 CodePointSetBuilder_box_destroy_registry.register(this, this.#ptr); 33 } 34 35 return this; 36 } 37 get ffiValue() { 38 return this.#ptr; 39 } 40 41 42 /** 43 * Make a new set builder containing nothing 44 * 45 * See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.new) for more information. 46 */ 47 #defaultConstructor() { 48 49 const result = wasm.icu4x_CodePointSetBuilder_create_mv1(); 50 51 try { 52 return new CodePointSetBuilder(diplomatRuntime.internalConstructor, result, []); 53 } 54 55 finally { 56 } 57 } 58 59 /** 60 * Build this into a set 61 * 62 * This object is repopulated with an empty builder 63 * 64 * See the [Rust documentation for `build`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.build) for more information. 65 */ 66 build() { 67 68 const result = wasm.icu4x_CodePointSetBuilder_build_mv1(this.ffiValue); 69 70 try { 71 return new CodePointSetData(diplomatRuntime.internalConstructor, result, []); 72 } 73 74 finally { 75 } 76 } 77 78 /** 79 * Complements this set 80 * 81 * (Elements in this set are removed and vice versa) 82 * 83 * See the [Rust documentation for `complement`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement) for more information. 84 */ 85 complement() { 86 wasm.icu4x_CodePointSetBuilder_complement_mv1(this.ffiValue); 87 88 try {} 89 90 finally { 91 } 92 } 93 94 /** 95 * Returns whether this set is empty 96 * 97 * See the [Rust documentation for `is_empty`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.is_empty) for more information. 98 */ 99 get isEmpty() { 100 101 const result = wasm.icu4x_CodePointSetBuilder_is_empty_mv1(this.ffiValue); 102 103 try { 104 return result; 105 } 106 107 finally { 108 } 109 } 110 111 /** 112 * Add a single character to the set 113 * 114 * See the [Rust documentation for `add_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_char) for more information. 115 */ 116 addChar(ch) { 117 wasm.icu4x_CodePointSetBuilder_add_char_mv1(this.ffiValue, ch); 118 119 try {} 120 121 finally { 122 } 123 } 124 125 /** 126 * Add an inclusive range of characters to the set 127 * 128 * See the [Rust documentation for `add_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_range) for more information. 129 */ 130 addInclusiveRange(start, end) { 131 wasm.icu4x_CodePointSetBuilder_add_inclusive_range_mv1(this.ffiValue, start, end); 132 133 try {} 134 135 finally { 136 } 137 } 138 139 /** 140 * Add all elements that belong to the provided set to the set 141 * 142 * See the [Rust documentation for `add_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_set) for more information. 143 */ 144 addSet(data) { 145 wasm.icu4x_CodePointSetBuilder_add_set_mv1(this.ffiValue, data.ffiValue); 146 147 try {} 148 149 finally { 150 } 151 } 152 153 /** 154 * Remove a single character to the set 155 * 156 * See the [Rust documentation for `remove_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.remove_char) for more information. 157 */ 158 removeChar(ch) { 159 wasm.icu4x_CodePointSetBuilder_remove_char_mv1(this.ffiValue, ch); 160 161 try {} 162 163 finally { 164 } 165 } 166 167 /** 168 * Remove an inclusive range of characters from the set 169 * 170 * See the [Rust documentation for `remove_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.remove_range) for more information. 171 */ 172 removeInclusiveRange(start, end) { 173 wasm.icu4x_CodePointSetBuilder_remove_inclusive_range_mv1(this.ffiValue, start, end); 174 175 try {} 176 177 finally { 178 } 179 } 180 181 /** 182 * Remove all elements that belong to the provided set from the set 183 * 184 * See the [Rust documentation for `remove_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.remove_set) for more information. 185 */ 186 removeSet(data) { 187 wasm.icu4x_CodePointSetBuilder_remove_set_mv1(this.ffiValue, data.ffiValue); 188 189 try {} 190 191 finally { 192 } 193 } 194 195 /** 196 * Removes all elements from the set except a single character 197 * 198 * See the [Rust documentation for `retain_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.retain_char) for more information. 199 */ 200 retainChar(ch) { 201 wasm.icu4x_CodePointSetBuilder_retain_char_mv1(this.ffiValue, ch); 202 203 try {} 204 205 finally { 206 } 207 } 208 209 /** 210 * Removes all elements from the set except an inclusive range of characters f 211 * 212 * See the [Rust documentation for `retain_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.retain_range) for more information. 213 */ 214 retainInclusiveRange(start, end) { 215 wasm.icu4x_CodePointSetBuilder_retain_inclusive_range_mv1(this.ffiValue, start, end); 216 217 try {} 218 219 finally { 220 } 221 } 222 223 /** 224 * Removes all elements from the set except all elements in the provided set 225 * 226 * See the [Rust documentation for `retain_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.retain_set) for more information. 227 */ 228 retainSet(data) { 229 wasm.icu4x_CodePointSetBuilder_retain_set_mv1(this.ffiValue, data.ffiValue); 230 231 try {} 232 233 finally { 234 } 235 } 236 237 /** 238 * Complement a single character to the set 239 * 240 * (Characters which are in this set are removed and vice versa) 241 * 242 * See the [Rust documentation for `complement_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement_char) for more information. 243 */ 244 complementChar(ch) { 245 wasm.icu4x_CodePointSetBuilder_complement_char_mv1(this.ffiValue, ch); 246 247 try {} 248 249 finally { 250 } 251 } 252 253 /** 254 * Complement an inclusive range of characters from the set 255 * 256 * (Characters which are in this set are removed and vice versa) 257 * 258 * See the [Rust documentation for `complement_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement_range) for more information. 259 */ 260 complementInclusiveRange(start, end) { 261 wasm.icu4x_CodePointSetBuilder_complement_inclusive_range_mv1(this.ffiValue, start, end); 262 263 try {} 264 265 finally { 266 } 267 } 268 269 /** 270 * Complement all elements that belong to the provided set from the set 271 * 272 * (Characters which are in this set are removed and vice versa) 273 * 274 * See the [Rust documentation for `complement_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement_set) for more information. 275 */ 276 complementSet(data) { 277 wasm.icu4x_CodePointSetBuilder_complement_set_mv1(this.ffiValue, data.ffiValue); 278 279 try {} 280 281 finally { 282 } 283 } 284 285 constructor() { 286 if (arguments[0] === diplomatRuntime.exposeConstructor) { 287 return this.#internalConstructor(...Array.prototype.slice.call(arguments, 1)); 288 } else if (arguments[0] === diplomatRuntime.internalConstructor) { 289 return this.#internalConstructor(...arguments); 290 } else { 291 return this.#defaultConstructor(...arguments); 292 } 293 } 294 }