pub trait ScreenCaptureSource {
// Required methods
fn metadata(&self) -> Result<SourceMetadata>;
fn stream(
&self,
foreground_executor: &ForegroundExecutor,
frame_callback: Box<dyn Fn(ScreenCaptureFrame) + Send>,
) -> Receiver<Result<Box<dyn ScreenCaptureStream>>> ⓘ;
// Provided method
fn stream_with_termination(
&self,
_foreground_executor: &ForegroundExecutor,
_frame_callback: Box<dyn Fn(ScreenCaptureFrame) + Send>,
_termination_callback: ScreenCaptureTerminationCallback,
) -> Receiver<Result<Box<dyn ScreenCaptureStream>>> ⓘ { ... }
}Expand description
A source of on-screen video content that can be captured.
Required Methods§
Sourcefn metadata(&self) -> Result<SourceMetadata>
fn metadata(&self) -> Result<SourceMetadata>
Returns metadata for this source.
Sourcefn stream(
&self,
foreground_executor: &ForegroundExecutor,
frame_callback: Box<dyn Fn(ScreenCaptureFrame) + Send>,
) -> Receiver<Result<Box<dyn ScreenCaptureStream>>> ⓘ
fn stream( &self, foreground_executor: &ForegroundExecutor, frame_callback: Box<dyn Fn(ScreenCaptureFrame) + Send>, ) -> Receiver<Result<Box<dyn ScreenCaptureStream>>> ⓘ
Start capture video from this source, invoking the given callback with each frame.
Provided Methods§
Sourcefn stream_with_termination(
&self,
_foreground_executor: &ForegroundExecutor,
_frame_callback: Box<dyn Fn(ScreenCaptureFrame) + Send>,
_termination_callback: ScreenCaptureTerminationCallback,
) -> Receiver<Result<Box<dyn ScreenCaptureStream>>> ⓘ
fn stream_with_termination( &self, _foreground_executor: &ForegroundExecutor, _frame_callback: Box<dyn Fn(ScreenCaptureFrame) + Send>, _termination_callback: ScreenCaptureTerminationCallback, ) -> Receiver<Result<Box<dyn ScreenCaptureStream>>> ⓘ
Starts capture and reports its terminal state.
Startup failures are returned through the receiver. Implementations
invoke termination_callback exactly once after a started stream ends,
is cancelled, or fails.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".