dioxus-chimeras 0.2.0

Dioxus integration for the chimeras camera library. Provides a preview server, frame registry, camera pump, a use_camera_stream hook, and a StreamPreview component for rendering live chimeras frames inside a Dioxus desktop app via WebGL2.
1
2
3
4
5
6
7
8
use std::sync::{Mutex, MutexGuard, PoisonError};

/// Lock a [`Mutex`] and recover from poisoning by taking the inner value.
///
/// Used crate-wide so a panicked writer never permanently disables a mutex.
pub(crate) fn recover_lock<T>(mutex: &Mutex<T>) -> MutexGuard<'_, T> {
    mutex.lock().unwrap_or_else(PoisonError::into_inner)
}