Rust reimplementation of VolumeAssistant.App for minimal memory footprint#10
Draft
Rust reimplementation of VolumeAssistant.App for minimal memory footprint#10
Conversation
Creates VolumeAssistant.App.Rust — a complete Rust project that cross-compiles from Linux to Windows using MinGW. Modules: - config: JSON config deserialization via serde - coordinator: shared AppState with Cambridge Audio status + logs - audio: WASAPI via raw COM vtables (windows-sys 0.59 pointer handles) - cambridge: WebSocket client (tungstenite 0.26 + handshake feature) - matter: stub UDP server, TLV encoder, device model - mdns: mDNS advertisement via mdns-sd 0.12 - tray: Win32 system tray using Shell_NotifyIconW - window: main window with tab control, labels, listbox - icon: GDI-drawn volume dial icon Key fixes applied during compilation: - Binary name uses VolumeAssistantApp (dots not allowed in crate names) - tungstenite requires features=["handshake"] for connect() - Message::text() used instead of Message::Text(s.into()) - Shell_NotifyIconW/NIM_ADD/NIM_DELETE imported from Win32::UI::Shell - TlvElement derives PartialEq for TlvType derive to work - windows-sys 0.59 handles are *mut c_void, not isize Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- icon.rs: use screen DC for CreateCompatibleBitmap to get color bitmap - matter/protocol.rs: clamp TLV string/bytestring length to 255 bytes - window/mod.rs: pre-collect all wide strings before LB_ADDSTRING calls - mdns.rs: replace infinite sleep loop with thread::park() - tray.rs: document intentional Arc::into_raw lifetime pattern - Remove unused imports and suppress only non_snake_case naming warnings Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: simonjlawson <7670716+simonjlawson@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Recreate VolumeAssistant.App with minimal memory footprint
Rust reimplementation of VolumeAssistant.App for minimal memory footprint
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The .NET WinForms tray app carries significant runtime overhead (~30–80 MB RAM, ~5–15 MB binary). This adds a Rust reimplementation targeting the smallest possible footprint.
New project:
src/VolumeAssistant.App.Rust/Full feature-parity Rust port compiled to
x86_64-pc-windows-gnunative PE, no .NET or C++ runtime dependency.Key implementation choices
windows-sys(raw FFI, no abstraction overhead) — tray icon (Shell_NotifyIconW), main window, GDI icon renderingIMMDeviceEnumerator→IAudioEndpointVolume) — no NAudio dependencytungstenite, blocking I/O in a dedicated thread) with exponential-backoff reconnectmdns-sd) — matching C# behaviourArc<Mutex<AppState>>instead of async runtime — eliminates tokio overheadappsettings.jsonparsed with identical JSON shape to the C# app (VolumeAssistant.Matternesting,CambridgeAudio,Appsections)VecDequefor O(1) front-removalRelease profile
Build
Other changes
.gitignore— excludessrc/VolumeAssistant.App.Rust/target/README.md— documents Rust app, build instructions, footprint comparison table💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.