Skip to main content

submilli_engine/runtime/prelude/textcodec/
mod.rs

1//! Stateless `TextEncoder` / `TextDecoder`, ported off the Wasm prelude. The
2//! instances carry no state — `new TextEncoder()` builds an empty `$ObjectShape`
3//! with the host generic `object` vtable, so `JSON.stringify` yields `{}` and
4//! `toString` yields `[object Object]` (parity with the old dedicated vtable).
5//! `encode` bridges the `$string` UTF-16 ABI to the `$Uint8Array` byte ABI;
6//! `decode` does the reverse. UTF-8 only: `decode` throws a catchable
7//! `TypeError` on invalid UTF-8. All marshalling and registration live in
8//! [`install`].
9
10mod install;
11
12pub(crate) use install::declare_types;
13pub use install::{declare, install};