跳到主要内容

GraphicsCaptureApiHandler

搜索

trait GraphicsCaptureApiHandler 

源代码
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 Flags

用于从设置中获取值的标志类型。

源代码

type Error: Send + Sync

捕获过程中可能发生的错误类型。错误将从 CaptureControlGraphicsCaptureApiHandler::start 函数返回。

必需方法§

源代码

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>

每当有新的帧可用时调用。

提供方法§

源代码

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>

捕获项(通常是窗口)关闭时调用的可选处理函数。

Dyn Compatibility§

此 trait 支持 dyn 兼容

在旧版本的 Rust 中,dyn 兼容性被称为 "object safety",因此此 trait 不是 object safe 的。

实现者§