Source code
Revision control
Copy as Markdown
Other Tools
// generated by diplomat-tool
import { TimeZoneAndCanonical } from "./TimeZoneAndCanonical.mjs"
import wasm from "./diplomat-wasm.mjs";
import * as diplomatRuntime from "./diplomat-runtime.mjs";
/**
* See the [Rust documentation for `TimeZoneAndCanonicalIter`](https://docs.rs/icu/latest/icu/time/zone/iana/struct.TimeZoneAndCanonicalIter.html) for more information.
*/
const TimeZoneAndCanonicalIterator_box_destroy_registry = new FinalizationRegistry((ptr) => {
wasm.icu4x_TimeZoneAndCanonicalIterator_destroy_mv1(ptr);
});
export class TimeZoneAndCanonicalIterator {
// Internal ptr reference:
#ptr = null;
// Lifetimes are only to keep dependencies alive.
// Since JS won't garbage collect until there are no incoming edges.
#selfEdge = [];
#aEdge = [];
#internalConstructor(symbol, ptr, selfEdge, aEdge) {
if (symbol !== diplomatRuntime.internalConstructor) {
console.error("TimeZoneAndCanonicalIterator is an Opaque type. You cannot call its constructor.");
return;
}
this.#aEdge = aEdge;
this.#ptr = ptr;
this.#selfEdge = selfEdge;
// Are we being borrowed? If not, we can register.
if (this.#selfEdge.length === 0) {
TimeZoneAndCanonicalIterator_box_destroy_registry.register(this, this.#ptr);
}
return this;
}
get ffiValue() {
return this.#ptr;
}
/**
* See the [Rust documentation for `next`](https://docs.rs/icu/latest/icu/time/zone/iana/struct.TimeZoneAndCanonicalIter.html#method.next) for more information.
*/
#iteratorNext() {
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 13, 4, true);
// This lifetime edge depends on lifetimes 'a
let aEdges = [this];
const result = wasm.icu4x_TimeZoneAndCanonicalIterator_next_mv1(diplomatReceive.buffer, this.ffiValue);
try {
if (!diplomatReceive.resultFlag) {
return null;
}
return TimeZoneAndCanonical._fromFFI(diplomatRuntime.internalConstructor, diplomatReceive.buffer, aEdges);
}
finally {
diplomatReceive.free();
}
}
next(){
const out = this.#iteratorNext();
return {
value: out,
done: out === null,
};
}
constructor(symbol, ptr, selfEdge, aEdge) {
return this.#internalConstructor(...arguments)
}
}