Language and platform choice
Decision (implemented)
| Decision | Choice |
|---|---|
| Language | Rust (single codebase) |
| UI | egui via eframe |
| Print protocol | ESC/POS (in-tree encoder) |
| MVP transport | USB-serial via serialport |
| Packaging | GitLab CI → Linux .deb, Windows .exe |
Rationale: One language, small dependency surface, direct control over ESC/POS bytes, native cross-platform UI without a WebView.
---
Requirements
| Requirement | How it is met |
|---|---|
| Windows + Linux | Rust + egui + GitLab CI |
| Raw USB-serial print (no spooler) | serialport crate, 9600 baud |
| ESC/POS generation | src/escpos.rs (no external ESC/POS crate) |
| Live preview | src/preview.rs + egui canvas in app.rs |
| Small distributable | No Chromium/Node; release build uses LTO + strip |
| Unit tests | Every module has #[cfg(test)] tests |
---
Dependencies in use
| Crate | Role | Why not hand-roll? |
|---|---|---|
eframe / egui | UI framework | Building a GUI toolkit is out of scope |
serde / serde_json | .pos files | Error-prone to parse/emit JSON manually |
serialport | Cross-platform COM/tty access | OS-specific serial APIs differ |
image | PNG/JPEG/GIF/BMP decode | Many formats and decoders |
rfd | Native file dialogs | OS-native UX expected |
Not used (by design): escpos, nusb, rusb, tauri, TypeScript frontend.
---
Candidates considered (historical)
| Option | Verdict |
|---|---|
| Rust + Tauri 2 + TypeScript | Rejected — two languages, WebView dependency |
| Rust + egui | Selected |
| C# + Avalonia | Viable but weaker serial/ESC/POS ecosystem |
| Go + Fyne | Weaker hardware I/O ecosystem |
| Python + PyQt | Poor packaging for desktop release |
| Electron | Bundle size too large |
| C++ + Qt | Slower iteration for a small app |
---
Platform notes
Windows
- Printers appear as
COMxafter USB-serial driver install. - Release:
posprint.exefromcargo build --release. - CI requires a GitLab runner tagged
windows+shell.
Linux
- Devices:
/dev/ttyUSB*,/dev/ttyACM*, etc. - User must be in the
dialoutgroup. - Release:
.debviacargo deb; install withsudo dpkg -i …. - CI uses
rust:bookwormimage with X11 dev libs for egui.
---
Deferred
| Item | Notes |
|---|---|
| USB printer class (bulk) | Would need nusb or Windows usbprint path |
| Bluetooth SPP | Paired devices as serial ports; add when requested |
| macOS | Same stack should work; not in CI yet |
This document should be updated when transport or UI choices change.
Source
| 1 | # Language and platform choice |
| 2 | |
| 3 | ## Decision (implemented) |
| 4 | |
| 5 | | Decision | Choice | |
| 6 | |----------|--------| |
| 7 | | Language | **Rust** (single codebase) | |
| 8 | | UI | **egui** via **eframe** | |
| 9 | | Print protocol | **ESC/POS** (in-tree encoder) | |
| 10 | | MVP transport | **USB-serial** via `serialport` | |
| 11 | | Packaging | GitLab CI → Linux `.deb`, Windows `.exe` | |
| 12 | |
| 13 | **Rationale:** One language, small dependency surface, direct control over ESC/POS bytes, native cross-platform UI without a WebView. |
| 14 | |
| 15 | --- |
| 16 | |
| 17 | ## Requirements |
| 18 | |
| 19 | | Requirement | How it is met | |
| 20 | |-------------|---------------| |
| 21 | | Windows + Linux | Rust + egui + GitLab CI | |
| 22 | | Raw USB-serial print (no spooler) | `serialport` crate, 9600 baud | |
| 23 | | ESC/POS generation | `src/escpos.rs` (no external ESC/POS crate) | |
| 24 | | Live preview | `src/preview.rs` + egui canvas in `app.rs` | |
| 25 | | Small distributable | No Chromium/Node; release build uses LTO + strip | |
| 26 | | Unit tests | Every module has `#[cfg(test)]` tests | |
| 27 | |
| 28 | --- |
| 29 | |
| 30 | ## Dependencies in use |
| 31 | |
| 32 | | Crate | Role | Why not hand-roll? | |
| 33 | |-------|------|-------------------| |
| 34 | | `eframe` / `egui` | UI framework | Building a GUI toolkit is out of scope | |
| 35 | | `serde` / `serde_json` | `.pos` files | Error-prone to parse/emit JSON manually | |
| 36 | | `serialport` | Cross-platform COM/tty access | OS-specific serial APIs differ | |
| 37 | | `image` | PNG/JPEG/GIF/BMP decode | Many formats and decoders | |
| 38 | | `rfd` | Native file dialogs | OS-native UX expected | |
| 39 | |
| 40 | **Not used (by design):** `escpos`, `nusb`, `rusb`, `tauri`, TypeScript frontend. |
| 41 | |
| 42 | --- |
| 43 | |
| 44 | ## Candidates considered (historical) |
| 45 | |
| 46 | | Option | Verdict | |
| 47 | |--------|---------| |
| 48 | | Rust + Tauri 2 + TypeScript | Rejected — two languages, WebView dependency | |
| 49 | | Rust + egui | **Selected** | |
| 50 | | C# + Avalonia | Viable but weaker serial/ESC/POS ecosystem | |
| 51 | | Go + Fyne | Weaker hardware I/O ecosystem | |
| 52 | | Python + PyQt | Poor packaging for desktop release | |
| 53 | | Electron | Bundle size too large | |
| 54 | | C++ + Qt | Slower iteration for a small app | |
| 55 | |
| 56 | --- |
| 57 | |
| 58 | ## Platform notes |
| 59 | |
| 60 | ### Windows |
| 61 | |
| 62 | - Printers appear as `COMx` after USB-serial driver install. |
| 63 | - Release: `posprint.exe` from `cargo build --release`. |
| 64 | - CI requires a GitLab runner tagged `windows` + `shell`. |
| 65 | |
| 66 | ### Linux |
| 67 | |
| 68 | - Devices: `/dev/ttyUSB*`, `/dev/ttyACM*`, etc. |
| 69 | - User must be in the **`dialout`** group. |
| 70 | - Release: `.deb` via `cargo deb`; install with `sudo dpkg -i …`. |
| 71 | - CI uses `rust:bookworm` image with X11 dev libs for egui. |
| 72 | |
| 73 | --- |
| 74 | |
| 75 | ## Deferred |
| 76 | |
| 77 | | Item | Notes | |
| 78 | |------|-------| |
| 79 | | USB printer class (bulk) | Would need `nusb` or Windows `usbprint` path | |
| 80 | | Bluetooth SPP | Paired devices as serial ports; add when requested | |
| 81 | | macOS | Same stack should work; not in CI yet | |
| 82 | |
| 83 | This document should be updated when transport or UI choices change. |