Numbers are derived from the repository at engine version 0.3.0 (edition 2021): the engine library crate counts src/*.rs only — the crate's [lib] path = "src/lib.rs" is the compiled source set. The C ABI lives in the sibling capi/ crate. A non-MIT UNLICENSED license; publish = false.
Crate layout
| crate | name | crate-type | role |
|---|---|---|---|
| engine | ztranslator-engine (lib ztranslator) | rlib (default) | the engine: model, sources, rules VM, BOME import/export, action executors |
| capi/ | ztranslator-capi | rlib · staticlib · cdylib | C ABI over the engine for non-Tauri hosts (zt_invoke + event callback) |
| tauri/ | tauri-plugin-ztranslator | (plugin crate) | Tauri-plugin bridge for webview hosts (Audio-Haxor, traderview) |
The README's rlib + staticlib + cdylib badge describes the ztranslator-capi crate; the engine library crate itself declares no crate-type and so builds as the default rlib.
Module map (engine)
| module | responsibility |
|---|---|
| model | Project > Preset > Translator data model; Incoming (28 trigger variants) and Outgoing (41 action variants); MIDI / keystroke / mouse / timer / route specs; JSON load_json / save_json |
| rules | signed-32-bit integer VM: Operand, BinOp (add sub mul div mod and or xor shl shr), CmpOp, Rule (Assign · Expr · Goto · Label · Log · SkipNext · ExitExecute · ExitIgnore · If · Comment); locals + globals; parse_program / program_to_source |
| matcher | matches an incoming event against a translator's Incoming spec, binding captured values for the rules VM |
| engine | Engine + worker thread: open inputs/outputs, virtual ports, router edges, start/stop, panic, test-fire; opens the non-MIDI trigger sources; emits EngineEvent to a sink |
| sources | non-MIDI trigger sources: OSC, Art-Net / sACN DMX, file watcher, serial, gamepad, HID, HTTP / WebSocket / MQTT / TCP, cron schedule, system events, audio level, Ableton Link |
| midi | MidiMessage parsing / encoding |
| actions | outgoing action executors; actions/macos.rs holds the OS-control paths (keystroke, mouse, AppleScript) that no-op off macOS |
| bmtp | BOME .bmtp import / import_str / export; option + payload parsing (parse_incoming / parse_outgoing) |
| serial · keycodes · error · timers | serial-port plumbing; key-code tables; Error / Result; engine timers |
C-ABI surface
The ztranslator-capi crate exports 4 extern "C" symbols; zt_invoke dispatches 37 distinct ztr_* commands.
void zt_set_event_callback(void (*cb)(const char* event_json)); char* zt_init(void); char* zt_invoke(const char* cmd, const char* args_json); void zt_string_free(char* s);
Dispatch commands cover lifecycle (ztr_engine_start · ztr_engine_stop · ztr_panic), ports / routes (ztr_list_ports · ztr_open_input · ztr_open_output · ztr_create_virtual_input · ztr_set_route), projects & rules (ztr_set_project · ztr_get_project · ztr_parse_rules · ztr_format_rules · ztr_save_json · ztr_load_json), and the non-MIDI sources (ztr_open_osc_input · ztr_open_artnet_input · ztr_watch_path · ztr_open_serial_input · ztr_open_gamepad_input · ztr_open_http_input · ztr_open_ws_input · ztr_open_mqtt_input · ztr_open_hid_input · ztr_open_schedule · ztr_open_sysevent · ztr_open_sacn_input · ztr_open_tcp_input · ztr_open_audio_input · ztr_open_link_input · ztr_open_rtpmidi_input · ztr_open_cv_output · ztr_inject_sysevent · ztr_close_source).
Dependency footprint
23 direct dependencies, all pure-Rust / foundational. Trigger and transport crates: midir (MIDI), rosc (OSC), serialport, notify (file watch), gilrs (gamepad), hidapi (USB-HID), tiny_http / ureq / tungstenite / rumqttc (HTTP / WebSocket / MQTT), cron + chrono (schedules), if-addrs + socket2 (network / sACN), rusty_link (Ableton Link). Art-Net DMX is decoded inline from a plain UDP packet — no crate. Data layer: serde + serde_json, thiserror, crossbeam-channel. The OS-control executors and audio input are gated to cfg(target_os = "macos") (core-graphics, core-foundation, foreign-types, cpal) so the cross-platform build stays dependency-clean.
Verification
65 test functions: 33 integration tests across tests/bmtp_import.rs, tests/engine_pipeline.rs, and tests/rules_vm.rs, plus 32 inline #[test] functions in the engine source. The BOME importer is driven against real .bmtp fixtures (Note Transpose, Controller Value Scaling, Simple Arpeggiator, Conditional MIDI mapping, one-shot timer, and an Ableton project). The rules suite exercises the integer VM's arithmetic / bitwise ops, conditionals, jumps, and execute / ignore outcomes; the pipeline suite drives the engine end to end. The deterministic core builds and runs in a headless Linux CI; macOS-only OS-control paths no-op off macOS.