Expand description
mf2-host-web — the Host of mf2-runtime in the browser
(wasm32-unknown-unknown, its only target): NFC through String.prototype.normalize
and the shortest round-trip text of a float through Number.prototype .toString, both via js-sys, so the wasm carries no normalization
tables and no float-printing code.
Dates and numbers (intl) come as
more hosts, not as more methods of HOST: a host method is linked
whenever its host is (it is in the Host vtable), so a date or number
method on HOST would cost every client that has the feature on,
dates or numbers or not. An application names the host its corpus
needs (mf2-build picks it):
| Static | Feature | Adds |
|---|---|---|
HOST | — | NFC, float text |
ZONES_HOST | time-zones | Host::zone_offset from the browser’s zone data (datetime-icu clients: named zones) |
INTL_HOST | datetime-intl | that, and Host::format_date_time through Intl.DateTimeFormat |
NUMBERS_HOST, IntlNumbers(&host) | intl | numbers through Intl.NumberFormat and Intl.PluralRules (Host::numbers) over another host |
§The user guide
The Rust MF2 book is the user
guide: how the crates fit together, web and native applications, the
command line, and what 2.x promises.
An application reaches this crate through
mf2, as mf2::host_web (feature host-web).
Structs§
- Intl
Numbers intl - A host with numbers through
Intl(featureintl): the number methods here, every other method from the host it wraps —crate::HOST, or a date host (IntlNumbers(&INTL_HOST)for a corpus with dates underdatetime-intl). Its own static, like the date hosts, so a client that formats no numbers names a host without this glue (B1′). It forwards eachHostmethod; a method added to the trait later must be forwarded here too. - Intl
WebHost datetime-intl - The browser host with dates through
Intl.DateTimeFormatand zone offsets from the browser’s zone data (datetime-intl). - WebHost
- The browser host.
- Zones
WebHost time-zones - The browser host with time-zone offsets from the browser’s zone data.
Statics§
- HOST
- The browser host, for
mf2_runtime::FormatContext::new. - INTL_
HOST datetime-intl IntlWebHost, formf2_runtime::FormatContext::new.- NUMBERS_
HOST intl IntlNumbersovercrate::HOST, formf2_runtime::FormatContext::new.- ZONES_
HOST time-zones ZonesWebHost, formf2_runtime::FormatContext::new.