--- name: Cargo feature matrix type: architecture-map-page slice: 03-audio-transcription last_verified: 2026/05/09 --- # Cargo feature matrix > **Where you are:** [Architecture map](../README.md) → [Audio + Transcription](README.md) → Cargo features **Plain English summary.** `magnotia-audio` has no Cargo features. `magnotia-transcription` has two: `whisper` (default on, gates `whisper-rs`, `whisper_rs_backend.rs`, and `load_whisper`) and `whisper-vulkan` (default on, additive Vulkan GPU offload). Parakeet is unconditional. The defaults give a desktop GPU build; non-Vulkan or cloud-only configurations turn features off explicitly. ## At a glance - Crate file: `crates/transcription/Cargo.toml` - Source of `[features]`: `crates/transcription/Cargo.toml:8-21`. - Source of conditionals in code: `#[cfg(feature = "whisper")]` in `crates/transcription/src/lib.rs:6` and `:10`, plus the gated `pub mod whisper_rs_backend;` and `load_whisper` re-export. Vulkan check inside `WhisperRsBackend::transcribe_sync` (`crates/transcription/src/whisper_rs_backend.rs:82`). ## Feature table | Feature | Default | Pulls in | Gates | |---|---|---|---| | `whisper` | yes | `whisper-rs 0.16` (optional dep) | `whisper_rs_backend` module, `load_whisper` re-export, the `set_initial_prompt` path | | `whisper-vulkan` | yes | `whisper-rs?/vulkan` | Compile-time GPU offload. Runtime gated additionally on `vulkan_loader_available()` | Other deps are unconditional (always present): `transcribe-rs 0.3` (Parakeet), `magnotia-core`, `tokio`, `reqwest`, `futures-util`, `sha2`, `thiserror`, `tracing`. Dev-only: `tempfile`, `num_cpus` (used by `thread_sweep.rs` to label physical vs logical core counts). ## Build commands Default (Whisper + Vulkan): ```sh cargo build -p magnotia-transcription ``` Whisper without Vulkan (CPU-only desktop, Android without GPU drivers): ```sh cargo build -p magnotia-transcription --no-default-features --features whisper ``` No Whisper at all (Parakeet only — useful for shrinking the binary and dropping `whisper-rs-sys`): ```sh cargo build -p magnotia-transcription --no-default-features ``` The `--no-default-features` form drops the `whisper_rs_backend` module entirely, so any sibling code holding a `WhisperRsBackend` will fail to compile. `LocalEngine`, `SpeechModelAdapter`, `load_parakeet`, and the streaming primitives stay available. ## Rationale (from Cargo.toml comments) - `whisper` exists as a feature so a future Windows non-AVX2 build, or a cloud-only ASR config, can drop `whisper-rs-sys` entirely (brief item #13). Disabling it also drops the `WhisperRsBackend` module and the `load_whisper` entry point. - `whisper-vulkan` is a separate feature so a non-Vulkan target (Android without GPU drivers, a CPU-only Windows build) can pull in `whisper-rs` but skip the Vulkan backend. - `transcribe-rs` is unconditional because today's only second engine (Parakeet) goes through it. Brief item #13's hypothetical "drop both engines" case would need a second feature flag introduced here. ## Watch-outs - **`whisper-vulkan` is purely additive.** Disabling it does not change `whisper`'s default build except for skipping the Vulkan backend selection. There is no separate "force CPU" or "force GPU" runtime flag; the backend probes `vulkan_loader_available()` and uses Vulkan if present. - **`thiserror` and `tracing` are not feature-gated.** Comments justify keeping them unconditional (small cost, broad usage). - **Reqwest features are pinned.** `default-features = false, features = ["rustls-tls", "stream"]`. There is no `native-tls` fallback path; `--features reqwest/native-tls` would rebuild the dep with the wrong TLS backend on Linux. - **`whisper-rs` is `default-features = false, optional = true`.** Whisper-rs's own default features can re-enable backends we don't want; setting `default-features = false` keeps the dep minimal and lets `whisper-vulkan` add the one feature we care about. - **Switching feature sets between builds invalidates the build cache.** A common slow-down for first-time contributors switching `--no-default-features` builds. ## See also - [Transcription whisper](transcription-whisper.md) — the gated module. - [Transcription parakeet](transcription-parakeet.md) — note Parakeet has no feature flag. - [Build tokenizers guard](build-tokenizers-guard.md) — Windows MSVC defence is part of the same brief item #6 thinking. - `crates/transcription/Cargo.toml` — the source of truth.