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