pub struct CameraStream { /* private fields */ }Expand description
A running capture stream. Dropping it stops the thread and releases the camera, which is what turns the hardware LED back off.
Implementations§
Source§impl CameraStream
impl CameraStream
Sourcepub fn latest_frame(&self) -> Option<Arc<Frame>>
pub fn latest_frame(&self) -> Option<Arc<Frame>>
The most recently delivered frame, or None before the first arrives.
Returns a shared Arc so polling at preview rate never copies the
pixel buffer.
Sourcepub fn take_frame(&self) -> Option<Arc<Frame>>
pub fn take_frame(&self) -> Option<Arc<Frame>>
Take the most recent frame out of the slot (the next delivered frame
refills it). A sole consumer that unwraps the Arc gets the pixel
buffer without copying it.
Sourcepub fn frame_generation(&self) -> u64
pub fn frame_generation(&self) -> u64
A counter that increments on every delivered frame, so the preview can skip rebuilding its texture when no new frame has arrived.
Trait Implementations§
Source§impl Drop for CameraStream
impl Drop for CameraStream
Auto Trait Implementations§
impl Freeze for CameraStream
impl RefUnwindSafe for CameraStream
impl Send for CameraStream
impl Sync for CameraStream
impl Unpin for CameraStream
impl UnsafeUnpin for CameraStream
impl UnwindSafe for CameraStream
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
Mutably borrows from an owned value. Read more