Skip to main content

Module host_label

Module host_label 

Source
Expand description

Sealed kebab-case label vocabulary shared across host bindings. See host_label for the formatter / parser pairs. Sealed kebab-case label vocabulary for cross-host serialisation.

Hosts (FFI / wasm / gdext / future) all need to render core enums as short string labels — "idle", "normal", "up" — and parse them back. Letting each host coin its own labels would let them drift, so this module is the single source of truth.

The label vocabulary is part of every host’s public contract: changing a label string is a breaking change for downstream consumers (TypeScript bindings, Godot scripts, GameMaker projects, …). New variants on #[non_exhaustive] core enums must add a label here in the same release; the formatters fall back to a stable default ("unknown", "out-of-service", "either") for unrecognised variants so a missing label does not panic the host.

Mirrors the host_error::ErrorKind cross-host vocabulary work.

Functions§

direction
Format a Direction as "up" / "down" / "either".
elevator_phase
Format an ElevatorPhase as a kebab-case label suitable for CSS class names, debug overlays, and serialised host events.
parse_call_direction
Parse a kebab-case label into a CallDirection.
parse_service_mode
Inverse of service_mode: parse a kebab-case label back to a ServiceMode. Unknown labels return None.
service_mode
Format a ServiceMode as a kebab-case label.