1// generated by diplomat-tool 2import wasm from "./diplomat-wasm.mjs"; 3import * as diplomatRuntime from "./diplomat-runtime.mjs"; 4 5 6/** See the [Rust documentation for `GraphemeClusterBreakIterator`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterBreakIterator.html) for more information. 7*/ 8const GraphemeClusterBreakIteratorUtf16_box_destroy_registry = new FinalizationRegistry((ptr) => { 9 wasm.icu4x_GraphemeClusterBreakIteratorUtf16_destroy_mv1(ptr); 10}); 11 12export class GraphemeClusterBreakIteratorUtf16 { 13 14 // Internal ptr reference: 15 #ptr = null; 16 17 // Lifetimes are only to keep dependencies alive. 18 // Since JS won't garbage collect until there are no incoming edges. 19 #selfEdge = []; 20 #aEdge = []; 21 22 #internalConstructor(symbol, ptr, selfEdge, aEdge) { 23 if (symbol !== diplomatRuntime.internalConstructor) { 24 console.error("GraphemeClusterBreakIteratorUtf16 is an Opaque type. You cannot call its constructor."); 25 return; 26 } 27 28 29 this.#aEdge = aEdge; 30 31 this.#ptr = ptr; 32 this.#selfEdge = selfEdge; 33 34 // Are we being borrowed? If not, we can register. 35 if (this.#selfEdge.length === 0) { 36 GraphemeClusterBreakIteratorUtf16_box_destroy_registry.register(this, this.#ptr); 37 } 38 39 return this; 40 } 41 get ffiValue() { 42 return this.#ptr; 43 } 44 45 next() { 46 const result = wasm.icu4x_GraphemeClusterBreakIteratorUtf16_next_mv1(this.ffiValue); 47 48 try { 49 return result; 50 } 51 52 finally {} 53 } 54 55 constructor(symbol, ptr, selfEdge, aEdge) { 56 return this.#internalConstructor(...arguments) 57 } 58}