1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
[]
= "whispercpp"
= "0.1.0"
= true
= true
= true
= true
= "README.md"
= "Safe Rust bindings for whisper.cpp speech recognition. Bundled patched build with memory-safety hardening, exception-catching FFI shim, and Send + Sync types."
= ["whisper", "asr", "speech-to-text", "transcription", "audio"]
= ["multimedia::audio", "api-bindings", "science"]
# docs.rs configuration. Backend features (metal/coreml/vulkan/cuda/...)
# gate the C++ build, not any Rust API surface, AND docs.rs's Linux build
# farm has none of the vendor SDKs they require, so `all-features = true`
# would fail. We enable `serde` so the `Lang` Serialize/Deserialize impls
# show up in the rendered docs.
[]
= ["serde"]
= ["--cfg", "docsrs"]
[]
= "whispercpp"
= "src/lib.rs"
[]
# Default: CPU build (no GPU dep). `cargo add whispercpp` Just
# Works on every platform (Apple, Linux, Windows) without a
# preinstalled whisper.cpp — but ships ZERO GPU acceleration.
# Opt into GPU backends explicitly per-target via the feature
# flags below; multi-platform consumers can document which
# accelerator each target needs in their own `Cargo.toml`
# rather than silently inheriting an Apple-Silicon-only set.
#
# whisper.cpp is **always** built from the vendored submodule
# in `whispercpp-sys/whisper.cpp/` and patched in `OUT_DIR`.
# There is no system / pkg-config path: routing safe-Rust
# code through a stock unpatched libwhisper would silently
# drop the memory-safety guarantees the bundled patches
# provide.
= []
# Enables `serde::{Serialize, Deserialize}` for `Lang`. The
# wire format is the lowercase ISO-639-1 string ("en", "yue",
# etc.) — see `Lang`'s impls.
= ["dep:serde", "smol_str/serde"]
# ── Backends ──────────────────────────────────────────────
#
# Each chains 1:1 to `whispercpp-sys`'s matching feature,
# which is what actually toggles whisper.cpp / ggml's CMake
# `-DGGML_*=ON` flag.
# Apple-only:
= ["whispercpp-sys/metal"] # GGML_METAL: Metal GPU
= ["whispercpp-sys/coreml"] # WHISPER_COREML: ANE encoder
# Cross-platform GPU:
= ["whispercpp-sys/vulkan"] # GGML_VULKAN: Vulkan compute
= ["whispercpp-sys/opencl"] # GGML_OPENCL: mobile / Adreno
# Vendor-specific GPU:
= ["whispercpp-sys/cuda"] # NVIDIA
= ["whispercpp-sys/hipblas"] # AMD ROCm/HIP
= ["whispercpp-sys/sycl"] # Intel oneAPI / Arc
= ["whispercpp-sys/musa"] # Moore Threads
# Encoder accelerators (similar role to CoreML on other vendors):
= ["whispercpp-sys/openvino"] # Intel OpenVINO
# CPU BLAS:
= ["whispercpp-sys/openblas"] # OpenBLAS
[]
# Low-level FFI to whisper.cpp. Path dep — sibling crate at
# `../whispercpp-sys/`. All `unsafe extern "C"` declarations
# live there; this crate only ever calls them behind safe
# wrappers.
= { = "0.1", = "../whispercpp-sys", = false }
# Public error type. `thiserror` keeps things light.
= { = "2", = false }
# Inline small strings (≤23 bytes) for error payloads — paths,
# language hints, single-char interior-NUL diagnostics. Avoids
# a heap allocation on every `WhisperError::ContextLoad` /
# `InvalidCString`.
= { = "0.3", = false }
# Optional serde, gated by the `serde` feature. When enabled,
# `Lang` round-trips through the canonical lowercase ISO-639-1
# string (`"en"`, `"yue"`, …).
= { = "1", = true, = false, = ["alloc"] }
[]
# Hound is for the `examples/smoke.rs` WAV reader only — never
# pulled into a production build of `whispercpp` itself.
= "3"
# `lang.rs`'s serde tests round-trip through JSON. Dev-only —
# no runtime cost in production builds.
= "1"
[[]]
= "smoke"
= "examples/smoke.rs"
[]
= true