Skip to main content

camera_stream/
stream.rs

1use crate::frame::Frame;
2
3/// Callback-based frame delivery.
4pub trait CameraStream {
5    type Frame<'a>: Frame
6    where
7        Self: 'a;
8    type Error: core::error::Error;
9
10    /// Start streaming. Callback is invoked on a platform thread for each frame.
11    fn start<F>(&mut self, callback: F) -> Result<(), Self::Error>
12    where
13        F: FnMut(&Self::Frame<'_>) + Send + 'static;
14
15    fn stop(&mut self) -> Result<(), Self::Error>;
16}