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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WasmThreadCapabilities
impl Debug for WasmThreadCapabilities
Source§impl Default for WasmThreadCapabilities
impl Default for WasmThreadCapabilities
Source§fn default() -> WasmThreadCapabilities
fn default() -> WasmThreadCapabilities
Auto Trait Implementations§
impl Freeze for WasmThreadCapabilities
impl RefUnwindSafe for WasmThreadCapabilities
impl Send for WasmThreadCapabilities
impl Sync for WasmThreadCapabilities
impl Unpin for WasmThreadCapabilities
impl UnsafeUnpin for WasmThreadCapabilities
impl UnwindSafe for WasmThreadCapabilities
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().