Expand description
Platform abstraction layer — time, keyboard, and sleep.
The Platform trait decouples the emulator core from the host OS.
This lets the same crate::emulator::Emulator run identically on
POSIX systems, Windows, and inside a WebAssembly sandbox — each with its
own implementation of this trait.
§Implementations
| Target | Type | Notes |
|---|---|---|
| Linux / macOS | posix_platform::PosixPlatform | Uses libc for time, terminal raw mode, and stdin |
| Windows | windows_platform::WindowsPlatform | Uses QueryPerformanceCounter and _kbhit/_getch |
| WebAssembly | wasm::WasmPlatform (private) | Uses web_sys::Performance; keyboard fed via JS callbacks |
§Adding a new platform
Implement Platform for your type and pass it to
crate::emulator::Emulator::run. No other changes are needed.
Modules§
Traits§
- Platform
- Host platform interface used by the emulator for time, I/O, and sleep.