Some checks failed
CI / rust (push) Has been cancelled
Fix 9 clippy warnings across mmc5 mapper and desktop frontend. Sync api_contract.md and architecture.md with actual public surface.
3.4 KiB
3.4 KiB
API Contract
This document defines the supported external contract for nesemu 0.x.
Use this file as the boundary of what external clients should rely on. For practical embedding examples, see integration.md. For internal structure, see architecture.md.
Supported Surface
External users should prefer these entry points:
- Root crate re-exports from
src/lib.rs nesemu::runtime::*nesemu::prelude::*
Optional adapter-facing API is available behind features:
adapter-apiadapter-headless
Recommended Public Entry Points
The main public API is organized around these groups:
- ROM loading:
parse_headerparse_romInesHeaderInesRomMirroring
- Cartridge mapping:
create_mapperMapper
- Low-level execution:
Cpu6502CpuBusCpuErrorNativeBusPpuApuApuStateTailChannelOutputs
- High-level runtime:
NesRuntimeRuntimeError
- Host execution and lifecycle:
RuntimeHostLoopClientRuntimeHostConfigEmulationState
- Host IO traits:
InputProviderVideoOutputAudioOutput
- Null/stub implementations:
NullInputNullVideoNullAudio
- Audio helpers:
AudioMixerRingBuffer
- Timing and pacing:
FrameClockFramePacerPacingClockNoopClockVideoMode
- Video constants:
FRAME_WIDTHFRAME_HEIGHTFRAME_RGBA_BYTES
- Input helpers:
JoypadButtonJoypadButtonsJOYPAD_BUTTON_ORDERJOYPAD_BUTTONS_COUNTset_button_pressedbutton_pressed
- State versioning:
SAVE_STATE_VERSION
Supported Client Flow
The expected integration flow is:
- Load ROM bytes and parse them, or construct
NesRuntimedirectly from ROM bytes. - Choose your integration level:
- use
Cpu6502+NativeBusfor low-level control - use
NesRuntimefor a higher-level core wrapper - use
RuntimeHostLooporClientRuntimefor host-facing frame execution
- use
- Provide input, video, and audio implementations through the public host traits.
- Use save/load state through the runtime or bus APIs when snapshot behavior is needed.
Stability Rules
The following are considered the primary supported surface for 0.x:
- root re-exports
runtimeprelude
The following are available but less stable:
native_core::*for advanced or experimental integrations
Lower-level modules may evolve faster than the root re-export surface.
Compatibility Notes
- Types marked
#[non_exhaustive]may gain fields or variants without a major version bump. - Save-state compatibility is only guaranteed within the same crate version unless explicitly documented otherwise.
- Optional features may expose additional adapter-facing API, but they do not change the baseline contract of the main library.
Extension Points
The intended extension points for hosts and frontends are:
InputProviderVideoOutputAudioOutputFrameClock- optional adapter bridge types when
adapter-apiis enabled:InputAdapterVideoAdapterAudioAdapterClockAdapter
Out Of Scope
This contract does not promise stability for:
- GTK frontend behavior in
nesemu-desktop - internal module layout under
native_coreandruntime - concrete implementation details of mapper modules
- cross-version save-state compatibility unless explicitly documented