pub trait GraphicsCaptureApiHandler: Sized {
type Flags;
type Error: Send + Sync;
// Required methods
fn new(ctx: Context<Self::Flags>) -> Result<Self, Self::Error>;
fn on_frame_arrived(
&mut self,
frame: &mut Frame<'_>,
capture_control: InternalCaptureControl,
) -> Result<(), Self::Error>;
// Provided methods
fn start<T: TryInto<GraphicsCaptureItemType>>(
settings: Settings<Self::Flags, T>,
) -> Result<(), GraphicsCaptureApiError<Self::Error>>
where Self: Send + 'static,
<Self as GraphicsCaptureApiHandler>::Flags: Send { ... }
fn start_free_threaded<T: TryInto<GraphicsCaptureItemType> + Send + 'static>(
settings: Settings<Self::Flags, T>,
) -> Result<CaptureControl<Self, Self::Error>, GraphicsCaptureApiError<Self::Error>>
where Self: Send + 'static,
<Self as GraphicsCaptureApiHandler>::Flags: Send { ... }
fn on_closed(&mut self) -> Result<(), Self::Error> { ... }
}展开描述
由处理图形捕获事件的类型实现的 trait。
必需的关联类型§
源代码type Error: Send + Sync
type Error: Send + Sync
捕获过程中可能发生的错误类型。错误将从
CaptureControl 和 GraphicsCaptureApiHandler::start 函数返回。
必需方法§
源代码fn on_frame_arrived(
&mut self,
frame: &mut Frame<'_>,
capture_control: InternalCaptureControl,
) -> Result<(), Self::Error>
fn on_frame_arrived( &mut self, frame: &mut Frame<'_>, capture_control: InternalCaptureControl, ) -> Result<(), Self::Error>
每当有新的帧可用时调用。
提供方法§
源代码fn start<T: TryInto<GraphicsCaptureItemType>>(
settings: Settings<Self::Flags, T>,
) -> Result<(), GraphicsCaptureApiError<Self::Error>>
fn start<T: TryInto<GraphicsCaptureItemType>>( settings: Settings<Self::Flags, T>, ) -> Result<(), GraphicsCaptureApiError<Self::Error>>
开始捕获并控制当前线程。
源代码fn start_free_threaded<T: TryInto<GraphicsCaptureItemType> + Send + 'static>(
settings: Settings<Self::Flags, T>,
) -> Result<CaptureControl<Self, Self::Error>, GraphicsCaptureApiError<Self::Error>>
fn start_free_threaded<T: TryInto<GraphicsCaptureItemType> + Send + 'static>( settings: Settings<Self::Flags, T>, ) -> Result<CaptureControl<Self, Self::Error>, GraphicsCaptureApiError<Self::Error>>
开始捕获,但不控制当前线程。
Dyn Compatibility§
此 trait 不 支持 dyn 兼容。
在旧版本的 Rust 中,dyn 兼容性被称为 "object safety",因此此 trait 不是 object safe 的。