Expand description
fc-core — the shared runtime for future-css WASM components.
§Why this crate exists
Every future-css WASM component needs the same three things: a panic hook, a version handshake with the JS side, and a structured error type. That is all this crate contains. It is the most expensive crate in the workspace per byte of functionality, because every consumer of every component links it.
Two rules follow from that. No component-specific logic belongs here, however tempting — a helper only rich text uses belongs in fc-rich-text, duplicated if a second component later needs it. And no dependency on any sibling crate: the arrow points down only.
§The versioning handshake
A CSS framework and a WASM module are versioned together, but a consumer
upgrades them independently and often loads the .wasm from a CDN or a
service-worker cache. If the JS layer and the module drift out of sync the
failure mode is a wrong-but-plausible result rather than a crash, which is
much worse to debug. abi_version makes that mismatch fail loudly on the
first call instead.
CSS and WASM are versioned separately on purpose: the CSS must work with no WASM at all, so bumping one must never force a bump of the other. The handshake covers the seam between them.
Enums§
- FcError
- The structured error every crate in the workspace returns across the boundary.
Constants§
- ABI_
VERSION - The ABI version of this core module.
Functions§
- abi_
version - Reported to JavaScript on load. Cheap, and the first thing to check when diagnosing a misbehaving integration.
- init_
panic_ hook - Installs a panic hook that prints a readable message to the console.
- normalize_
range - Normalizes a text offset pair into a half-open range
[start, end).