pub struct CaptureControl<T: GraphicsCaptureApiHandler + Send + 'static, E> { /* private fields */ }展开描述
用于控制捕获会话
实现§
源代码§impl<T: GraphicsCaptureApiHandler + Send + 'static, E> CaptureControl<T, E>
impl<T: GraphicsCaptureApiHandler + Send + 'static, E> CaptureControl<T, E>
源代码pub const fn new(
thread_handle: JoinHandle<Result<(), GraphicsCaptureApiError<E>>>,
halt_handle: Arc<AtomicBool>,
callback: Arc<Mutex<T>>,
) -> Self
pub const fn new( thread_handle: JoinHandle<Result<(), GraphicsCaptureApiError<E>>>, halt_handle: Arc<AtomicBool>, callback: Arc<Mutex<T>>, ) -> Self
构造一个新的 CaptureControl。
源代码pub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
检查捕获线程是否已结束。
源代码pub fn into_thread_handle(
self,
) -> JoinHandle<Result<(), GraphicsCaptureApiError<E>>>
pub fn into_thread_handle( self, ) -> JoinHandle<Result<(), GraphicsCaptureApiError<E>>>
获取捕获线程的 join 句柄。
源代码pub fn halt_handle(&self) -> Arc<AtomicBool>
pub fn halt_handle(&self) -> Arc<AtomicBool>
获取用于暂停捕获线程的 halt 句柄。
源代码pub fn wait(self) -> Result<(), CaptureControlError<E>>
pub fn wait(self) -> Result<(), CaptureControlError<E>>
等待捕获线程停止。
§Errors
CaptureControlError::FailedToJoinThreadwhen joining the internal thread failsCaptureControlError::ThreadHandleIsTakenwhen the thread handle was previously taken viaCaptureControl::into_thread_handle
源代码pub fn stop(self) -> Result<(), CaptureControlError<E>>
pub fn stop(self) -> Result<(), CaptureControlError<E>>
优雅地请求捕获线程停止,并等待其完成。
这会向捕获线程发送 WM_QUIT 消息并等待其结束。
§Errors
CaptureControlError::FailedToPostThreadMessagewhen posting WM_QUIT to the thread fails and the thread is still runningCaptureControlError::FailedToJoinThreadwhen joining the internal thread failsCaptureControlError::ThreadHandleIsTakenwhen the thread handle was previously taken viaCaptureControl::into_thread_handle
自动 trait 实现§
impl<T, E> Freeze for CaptureControl<T, E>
impl<T, E> !RefUnwindSafe for CaptureControl<T, E>
impl<T, E> Send for CaptureControl<T, E>
impl<T, E> Sync for CaptureControl<T, E>
impl<T, E> Unpin for CaptureControl<T, E>
impl<T, E> UnsafeUnpin for CaptureControl<T, E>
impl<T, E> !UnwindSafe for CaptureControl<T, E>
blanket 实现§
源代码§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
源代码§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
从拥有的值可变地借用。 阅读更多
源代码§impl<T> IntoEither for T
impl<T> IntoEither for T
源代码§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. 阅读更多源代码§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. 阅读更多