pub struct WasmThreadCapabilities {
pub cross_origin_isolated: bool,
pub shared_array_buffer: bool,
pub atomics: bool,
pub hardware_concurrency: u32,
pub coop_header: Option<String>,
pub coep_header: Option<String>,
pub is_secure_context: bool,
pub errors: Vec<String>,
}Expand description
WASM threading capabilities detected from browser context
Fields§
§cross_origin_isolated: boolWhether crossOriginIsolated is true in the browser
Whether SharedArrayBuffer is available
atomics: boolWhether Atomics is available
hardware_concurrency: u32navigator.hardwareConcurrency value
coop_header: Option<String>COOP header value (if present)
coep_header: Option<String>COEP header value (if present)
is_secure_context: boolWhether the page is served over HTTPS (required for SAB)
errors: Vec<String>Error messages collected during detection
Implementations§
Source§impl WasmThreadCapabilities
impl WasmThreadCapabilities
Sourcepub fn full_support() -> Self
pub fn full_support() -> Self
Create capabilities indicating full threading support
Sourcepub fn no_support() -> Self
pub fn no_support() -> Self
Create capabilities indicating no threading support
Sourcepub fn assert_threading_ready(&self) -> Result<(), CapabilityError>
pub fn assert_threading_ready(&self) -> Result<(), CapabilityError>
Assert all requirements for multi-threaded WASM
§Errors
Returns error with detailed message if any requirement is not met
Sourcepub fn assert_streaming_ready(&self) -> Result<(), CapabilityError>
pub fn assert_streaming_ready(&self) -> Result<(), CapabilityError>
Assert requirements for streaming audio processing
Streaming requires threading for real-time performance
§Errors
Returns error if streaming requirements are not met
Sourcepub fn optimal_threads(&self) -> u32
pub fn optimal_threads(&self) -> u32
Get recommended thread count for optimal performance
Per whisper.apr: N_threads = max(1, min(hardwareConcurrency - 1, 8))
Sourcepub fn is_threading_available(&self) -> bool
pub fn is_threading_available(&self) -> bool
Check if threading is available (non-asserting)
Check SharedArrayBuffer status
Sourcepub fn detection_js() -> &'static str
pub fn detection_js() -> &'static str
Generate JavaScript code to detect capabilities in browser
Trait Implementations§
Source§impl Clone for WasmThreadCapabilities
impl Clone for WasmThreadCapabilities
Source§fn clone(&self) -> WasmThreadCapabilities
fn clone(&self) -> WasmThreadCapabilities
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more