voxora_backend/lib.rs
1//! Cross-cutting hardware backend selection for voxora ASR engines.
2//!
3//! Centralises `Cpu / Cuda / Metal / Vulkan` selection so engines no
4//! longer each declare their own `cpu` / `cuda` / `metal` / `vulkan`
5//! feature wiring.
6//!
7//! ASR-specific: this crate only models hardware backends that are
8//! relevant to the voxora speech-recognition stack. It does not
9//! abstract LLama.cpp or any other non-ASR backend.
10//!
11//! ## Phase 0 surface
12//!
13//! Today the crate only exposes:
14//!
15//! - [`BackendKind`] (re-exported from `voxora-engine`).
16//! - [`Capabilities`] — compile-time + runtime snapshot.
17//! - [`best_device`] / [`best_device_or_error`] — current "always
18//! returns CPU" implementation.
19//!
20//! The real candle-backed detection lands in 0.2.x once voxora-backend
21//! gains a `candle` feature flag.
22
23#![forbid(unsafe_code)]
24#![warn(missing_docs)]
25
26pub mod capabilities;
27pub mod device;
28pub mod error;
29pub mod kind;
30
31pub use capabilities::Capabilities;
32pub use device::{best_device, best_device_or_error, detect};
33pub use error::BackendError;
34pub use kind::BackendKind;
35
36#[cfg(test)]
37mod tests {
38 use super::*;
39
40 #[test]
41 fn public_surface_round_trips() {
42 let kind = BackendKind::Cpu;
43 assert_eq!(kind.as_config(), "cpu");
44 }
45
46 #[test]
47 fn detect_compiles_in_cpu_always() {
48 let caps = detect();
49 assert!(caps.is_compiled(BackendKind::Cpu));
50 }
51}