windows_core::imp::define_interface!( AsyncActionCompletedHandler, AsyncActionCompletedHandler_Vtbl, 0xa4ed5c81_76c9_40bd_8be6_b1d90fb20ae7 ); impl windows_core::RuntimeType for AsyncActionCompletedHandler { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_interface::(); } impl AsyncActionCompletedHandler { pub fn new< F: Fn(windows_core::Ref, AsyncStatus) -> windows_core::Result<()> + Send + 'static, >( invoke: F, ) -> Self { let com = AsyncActionCompletedHandlerBox { vtable: &AsyncActionCompletedHandlerBox::::VTABLE, count: windows_core::imp::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(windows_core::imp::Box::new(com)) } } pub fn Invoke(&self, asyncinfo: P0, asyncstatus: AsyncStatus) -> windows_core::Result<()> where P0: windows_core::Param, { let this = self; unsafe { (windows_core::Interface::vtable(this).Invoke)( windows_core::Interface::as_raw(this), asyncinfo.param().abi(), asyncstatus, ) .ok() } } } #[repr(C)] #[doc(hidden)] pub struct AsyncActionCompletedHandler_Vtbl { base__: windows_core::IUnknown_Vtbl, Invoke: unsafe extern "system" fn( this: *mut core::ffi::c_void, asyncinfo: *mut core::ffi::c_void, asyncstatus: AsyncStatus, ) -> windows_core::HRESULT, } #[repr(C)] struct AsyncActionCompletedHandlerBox< F: Fn(windows_core::Ref, AsyncStatus) -> windows_core::Result<()> + Send + 'static, > { vtable: *const AsyncActionCompletedHandler_Vtbl, invoke: F, count: windows_core::imp::RefCount, } impl< F: Fn(windows_core::Ref, AsyncStatus) -> windows_core::Result<()> + Send + 'static, > AsyncActionCompletedHandlerBox { const VTABLE: AsyncActionCompletedHandler_Vtbl = AsyncActionCompletedHandler_Vtbl { base__: windows_core::IUnknown_Vtbl { QueryInterface: Self::QueryInterface, AddRef: Self::AddRef, Release: Self::Release, }, Invoke: Self::Invoke, }; unsafe extern "system" fn QueryInterface( this: *mut core::ffi::c_void, iid: *const windows_core::GUID, interface: *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; if iid.is_null() || interface.is_null() { return windows_core::HRESULT(-2147467261); } *interface = if *iid == ::IID || *iid == ::IID || *iid == ::IID { &mut (*this).vtable as *mut _ as _ } else if *iid == ::IID { (*this).count.add_ref(); return windows_core::imp::marshaler( core::mem::transmute(&mut (*this).vtable as *mut _ as *mut core::ffi::c_void), interface, ); } else { core::ptr::null_mut() }; if (*interface).is_null() { windows_core::HRESULT(-2147467262) } else { (*this).count.add_ref(); windows_core::HRESULT(0) } } } unsafe extern "system" fn AddRef(this: *mut core::ffi::c_void) -> u32 { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; (*this).count.add_ref() } } unsafe extern "system" fn Release(this: *mut core::ffi::c_void) -> u32 { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { let _ = windows_core::imp::Box::from_raw(this); } remaining } } unsafe extern "system" fn Invoke( this: *mut core::ffi::c_void, asyncinfo: *mut core::ffi::c_void, asyncstatus: AsyncStatus, ) -> windows_core::HRESULT { unsafe { let this = &mut *(this as *mut *mut core::ffi::c_void as *mut Self); (this.invoke)(core::mem::transmute_copy(&asyncinfo), asyncstatus).into() } } } #[repr(transparent)] #[derive(Clone, Debug, Eq, PartialEq)] pub struct AsyncActionProgressHandler( windows_core::IUnknown, core::marker::PhantomData, ) where TProgress: windows_core::RuntimeType + 'static; unsafe impl windows_core::Interface for AsyncActionProgressHandler { type Vtable = AsyncActionProgressHandler_Vtbl; const IID: windows_core::GUID = windows_core::GUID::from_signature(::SIGNATURE); } impl windows_core::RuntimeType for AsyncActionProgressHandler { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new() .push_slice(b"pinterface({6d844858-0cff-4590-ae89-95a5a5c8b4b8}") .push_slice(b";") .push_other(TProgress::SIGNATURE) .push_slice(b")"); } impl AsyncActionProgressHandler { pub fn new< F: Fn( windows_core::Ref>, windows_core::Ref, ) -> windows_core::Result<()> + Send + 'static, >( invoke: F, ) -> Self { let com = AsyncActionProgressHandlerBox { vtable: &AsyncActionProgressHandlerBox::::VTABLE, count: windows_core::imp::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(windows_core::imp::Box::new(com)) } } pub fn Invoke(&self, asyncinfo: P0, progressinfo: P1) -> windows_core::Result<()> where P0: windows_core::Param>, P1: windows_core::Param, { let this = self; unsafe { (windows_core::Interface::vtable(this).Invoke)( windows_core::Interface::as_raw(this), asyncinfo.param().abi(), progressinfo.param().abi(), ) .ok() } } } #[repr(C)] #[doc(hidden)] pub struct AsyncActionProgressHandler_Vtbl where TProgress: windows_core::RuntimeType + 'static, { base__: windows_core::IUnknown_Vtbl, Invoke: unsafe extern "system" fn( this: *mut core::ffi::c_void, asyncinfo: *mut core::ffi::c_void, progressinfo: windows_core::AbiType, ) -> windows_core::HRESULT, TProgress: core::marker::PhantomData, } #[repr(C)] struct AsyncActionProgressHandlerBox< TProgress, F: Fn( windows_core::Ref>, windows_core::Ref, ) -> windows_core::Result<()> + Send + 'static, > where TProgress: windows_core::RuntimeType + 'static, { vtable: *const AsyncActionProgressHandler_Vtbl, invoke: F, count: windows_core::imp::RefCount, } impl< TProgress: windows_core::RuntimeType + 'static, F: Fn( windows_core::Ref>, windows_core::Ref, ) -> windows_core::Result<()> + Send + 'static, > AsyncActionProgressHandlerBox { const VTABLE: AsyncActionProgressHandler_Vtbl = AsyncActionProgressHandler_Vtbl:: { base__: windows_core::IUnknown_Vtbl { QueryInterface: Self::QueryInterface, AddRef: Self::AddRef, Release: Self::Release, }, Invoke: Self::Invoke, TProgress: core::marker::PhantomData::, }; unsafe extern "system" fn QueryInterface( this: *mut core::ffi::c_void, iid: *const windows_core::GUID, interface: *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; if iid.is_null() || interface.is_null() { return windows_core::HRESULT(-2147467261); } *interface = if *iid == as windows_core::Interface>::IID || *iid == ::IID || *iid == ::IID { &mut (*this).vtable as *mut _ as _ } else if *iid == ::IID { (*this).count.add_ref(); return windows_core::imp::marshaler( core::mem::transmute(&mut (*this).vtable as *mut _ as *mut core::ffi::c_void), interface, ); } else { core::ptr::null_mut() }; if (*interface).is_null() { windows_core::HRESULT(-2147467262) } else { (*this).count.add_ref(); windows_core::HRESULT(0) } } } unsafe extern "system" fn AddRef(this: *mut core::ffi::c_void) -> u32 { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; (*this).count.add_ref() } } unsafe extern "system" fn Release(this: *mut core::ffi::c_void) -> u32 { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { let _ = windows_core::imp::Box::from_raw(this); } remaining } } unsafe extern "system" fn Invoke( this: *mut core::ffi::c_void, asyncinfo: *mut core::ffi::c_void, progressinfo: windows_core::AbiType, ) -> windows_core::HRESULT { unsafe { let this = &mut *(this as *mut *mut core::ffi::c_void as *mut Self); (this.invoke)( core::mem::transmute_copy(&asyncinfo), core::mem::transmute_copy(&progressinfo), ) .into() } } } #[repr(transparent)] #[derive(Clone, Debug, Eq, PartialEq)] pub struct AsyncActionWithProgressCompletedHandler( windows_core::IUnknown, core::marker::PhantomData, ) where TProgress: windows_core::RuntimeType + 'static; unsafe impl windows_core::Interface for AsyncActionWithProgressCompletedHandler { type Vtable = AsyncActionWithProgressCompletedHandler_Vtbl; const IID: windows_core::GUID = windows_core::GUID::from_signature(::SIGNATURE); } impl windows_core::RuntimeType for AsyncActionWithProgressCompletedHandler { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new() .push_slice(b"pinterface({9c029f91-cc84-44fd-ac26-0a6c4e555281}") .push_slice(b";") .push_other(TProgress::SIGNATURE) .push_slice(b")"); } impl AsyncActionWithProgressCompletedHandler { pub fn new< F: Fn( windows_core::Ref>, AsyncStatus, ) -> windows_core::Result<()> + Send + 'static, >( invoke: F, ) -> Self { let com = AsyncActionWithProgressCompletedHandlerBox { vtable: &AsyncActionWithProgressCompletedHandlerBox::::VTABLE, count: windows_core::imp::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(windows_core::imp::Box::new(com)) } } pub fn Invoke(&self, asyncinfo: P0, asyncstatus: AsyncStatus) -> windows_core::Result<()> where P0: windows_core::Param>, { let this = self; unsafe { (windows_core::Interface::vtable(this).Invoke)( windows_core::Interface::as_raw(this), asyncinfo.param().abi(), asyncstatus, ) .ok() } } } #[repr(C)] #[doc(hidden)] pub struct AsyncActionWithProgressCompletedHandler_Vtbl where TProgress: windows_core::RuntimeType + 'static, { base__: windows_core::IUnknown_Vtbl, Invoke: unsafe extern "system" fn( this: *mut core::ffi::c_void, asyncinfo: *mut core::ffi::c_void, asyncstatus: AsyncStatus, ) -> windows_core::HRESULT, TProgress: core::marker::PhantomData, } #[repr(C)] struct AsyncActionWithProgressCompletedHandlerBox< TProgress, F: Fn( windows_core::Ref>, AsyncStatus, ) -> windows_core::Result<()> + Send + 'static, > where TProgress: windows_core::RuntimeType + 'static, { vtable: *const AsyncActionWithProgressCompletedHandler_Vtbl, invoke: F, count: windows_core::imp::RefCount, } impl< TProgress: windows_core::RuntimeType + 'static, F: Fn( windows_core::Ref>, AsyncStatus, ) -> windows_core::Result<()> + Send + 'static, > AsyncActionWithProgressCompletedHandlerBox { const VTABLE: AsyncActionWithProgressCompletedHandler_Vtbl = AsyncActionWithProgressCompletedHandler_Vtbl:: { base__: windows_core::IUnknown_Vtbl { QueryInterface: Self::QueryInterface, AddRef: Self::AddRef, Release: Self::Release, }, Invoke: Self::Invoke, TProgress: core::marker::PhantomData::, }; unsafe extern "system" fn QueryInterface( this: *mut core::ffi::c_void, iid: *const windows_core::GUID, interface: *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; if iid.is_null() || interface.is_null() { return windows_core::HRESULT(-2147467261); } * interface = if * iid == < AsyncActionWithProgressCompletedHandler < TProgress > as windows_core::Interface >::IID || * iid == < windows_core::IUnknown as windows_core::Interface >::IID || * iid == < windows_core::imp::IAgileObject as windows_core::Interface >::IID { & mut ( * this ) . vtable as * mut _ as _ } else if * iid == < windows_core::imp::IMarshal as windows_core::Interface >::IID { ( * this ) . count . add_ref ( ) ; return windows_core::imp::marshaler ( core::mem::transmute ( & mut ( * this ) . vtable as * mut _ as * mut core::ffi::c_void ) , interface ) ; } else { core::ptr::null_mut ( ) } ; if (*interface).is_null() { windows_core::HRESULT(-2147467262) } else { (*this).count.add_ref(); windows_core::HRESULT(0) } } } unsafe extern "system" fn AddRef(this: *mut core::ffi::c_void) -> u32 { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; (*this).count.add_ref() } } unsafe extern "system" fn Release(this: *mut core::ffi::c_void) -> u32 { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { let _ = windows_core::imp::Box::from_raw(this); } remaining } } unsafe extern "system" fn Invoke( this: *mut core::ffi::c_void, asyncinfo: *mut core::ffi::c_void, asyncstatus: AsyncStatus, ) -> windows_core::HRESULT { unsafe { let this = &mut *(this as *mut *mut core::ffi::c_void as *mut Self); (this.invoke)(core::mem::transmute_copy(&asyncinfo), asyncstatus).into() } } } #[repr(transparent)] #[derive(Clone, Debug, Eq, PartialEq)] pub struct AsyncOperationCompletedHandler( windows_core::IUnknown, core::marker::PhantomData, ) where TResult: windows_core::RuntimeType + 'static; unsafe impl windows_core::Interface for AsyncOperationCompletedHandler { type Vtable = AsyncOperationCompletedHandler_Vtbl; const IID: windows_core::GUID = windows_core::GUID::from_signature(::SIGNATURE); } impl windows_core::RuntimeType for AsyncOperationCompletedHandler { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new() .push_slice(b"pinterface({fcdcf02c-e5d8-4478-915a-4d90b74b83a5}") .push_slice(b";") .push_other(TResult::SIGNATURE) .push_slice(b")"); } impl AsyncOperationCompletedHandler { pub fn new< F: Fn(windows_core::Ref>, AsyncStatus) -> windows_core::Result<()> + Send + 'static, >( invoke: F, ) -> Self { let com = AsyncOperationCompletedHandlerBox { vtable: &AsyncOperationCompletedHandlerBox::::VTABLE, count: windows_core::imp::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(windows_core::imp::Box::new(com)) } } pub fn Invoke(&self, asyncinfo: P0, asyncstatus: AsyncStatus) -> windows_core::Result<()> where P0: windows_core::Param>, { let this = self; unsafe { (windows_core::Interface::vtable(this).Invoke)( windows_core::Interface::as_raw(this), asyncinfo.param().abi(), asyncstatus, ) .ok() } } } #[repr(C)] #[doc(hidden)] pub struct AsyncOperationCompletedHandler_Vtbl where TResult: windows_core::RuntimeType + 'static, { base__: windows_core::IUnknown_Vtbl, Invoke: unsafe extern "system" fn( this: *mut core::ffi::c_void, asyncinfo: *mut core::ffi::c_void, asyncstatus: AsyncStatus, ) -> windows_core::HRESULT, TResult: core::marker::PhantomData, } #[repr(C)] struct AsyncOperationCompletedHandlerBox< TResult, F: Fn(windows_core::Ref>, AsyncStatus) -> windows_core::Result<()> + Send + 'static, > where TResult: windows_core::RuntimeType + 'static, { vtable: *const AsyncOperationCompletedHandler_Vtbl, invoke: F, count: windows_core::imp::RefCount, } impl< TResult: windows_core::RuntimeType + 'static, F: Fn(windows_core::Ref>, AsyncStatus) -> windows_core::Result<()> + Send + 'static, > AsyncOperationCompletedHandlerBox { const VTABLE: AsyncOperationCompletedHandler_Vtbl = AsyncOperationCompletedHandler_Vtbl:: { base__: windows_core::IUnknown_Vtbl { QueryInterface: Self::QueryInterface, AddRef: Self::AddRef, Release: Self::Release, }, Invoke: Self::Invoke, TResult: core::marker::PhantomData::, }; unsafe extern "system" fn QueryInterface( this: *mut core::ffi::c_void, iid: *const windows_core::GUID, interface: *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; if iid.is_null() || interface.is_null() { return windows_core::HRESULT(-2147467261); } *interface = if *iid == as windows_core::Interface>::IID || *iid == ::IID || *iid == ::IID { &mut (*this).vtable as *mut _ as _ } else if *iid == ::IID { (*this).count.add_ref(); return windows_core::imp::marshaler( core::mem::transmute(&mut (*this).vtable as *mut _ as *mut core::ffi::c_void), interface, ); } else { core::ptr::null_mut() }; if (*interface).is_null() { windows_core::HRESULT(-2147467262) } else { (*this).count.add_ref(); windows_core::HRESULT(0) } } } unsafe extern "system" fn AddRef(this: *mut core::ffi::c_void) -> u32 { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; (*this).count.add_ref() } } unsafe extern "system" fn Release(this: *mut core::ffi::c_void) -> u32 { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { let _ = windows_core::imp::Box::from_raw(this); } remaining } } unsafe extern "system" fn Invoke( this: *mut core::ffi::c_void, asyncinfo: *mut core::ffi::c_void, asyncstatus: AsyncStatus, ) -> windows_core::HRESULT { unsafe { let this = &mut *(this as *mut *mut core::ffi::c_void as *mut Self); (this.invoke)(core::mem::transmute_copy(&asyncinfo), asyncstatus).into() } } } #[repr(transparent)] #[derive(Clone, Debug, Eq, PartialEq)] pub struct AsyncOperationProgressHandler( windows_core::IUnknown, core::marker::PhantomData, core::marker::PhantomData, ) where TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static; unsafe impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > windows_core::Interface for AsyncOperationProgressHandler { type Vtable = AsyncOperationProgressHandler_Vtbl; const IID: windows_core::GUID = windows_core::GUID::from_signature(::SIGNATURE); } impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > windows_core::RuntimeType for AsyncOperationProgressHandler { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new() .push_slice(b"pinterface({55690902-0aab-421a-8778-f8ce5026d758}") .push_slice(b";") .push_other(TResult::SIGNATURE) .push_slice(b";") .push_other(TProgress::SIGNATURE) .push_slice(b")"); } impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > AsyncOperationProgressHandler { pub fn new< F: Fn( windows_core::Ref>, windows_core::Ref, ) -> windows_core::Result<()> + Send + 'static, >( invoke: F, ) -> Self { let com = AsyncOperationProgressHandlerBox { vtable: &AsyncOperationProgressHandlerBox::::VTABLE, count: windows_core::imp::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(windows_core::imp::Box::new(com)) } } pub fn Invoke(&self, asyncinfo: P0, progressinfo: P1) -> windows_core::Result<()> where P0: windows_core::Param>, P1: windows_core::Param, { let this = self; unsafe { (windows_core::Interface::vtable(this).Invoke)( windows_core::Interface::as_raw(this), asyncinfo.param().abi(), progressinfo.param().abi(), ) .ok() } } } #[repr(C)] #[doc(hidden)] pub struct AsyncOperationProgressHandler_Vtbl where TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, { base__: windows_core::IUnknown_Vtbl, Invoke: unsafe extern "system" fn( this: *mut core::ffi::c_void, asyncinfo: *mut core::ffi::c_void, progressinfo: windows_core::AbiType, ) -> windows_core::HRESULT, TResult: core::marker::PhantomData, TProgress: core::marker::PhantomData, } #[repr(C)] struct AsyncOperationProgressHandlerBox< TResult, TProgress, F: Fn( windows_core::Ref>, windows_core::Ref, ) -> windows_core::Result<()> + Send + 'static, > where TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, { vtable: *const AsyncOperationProgressHandler_Vtbl, invoke: F, count: windows_core::imp::RefCount, } impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, F: Fn( windows_core::Ref>, windows_core::Ref, ) -> windows_core::Result<()> + Send + 'static, > AsyncOperationProgressHandlerBox { const VTABLE: AsyncOperationProgressHandler_Vtbl = AsyncOperationProgressHandler_Vtbl:: { base__: windows_core::IUnknown_Vtbl { QueryInterface: Self::QueryInterface, AddRef: Self::AddRef, Release: Self::Release, }, Invoke: Self::Invoke, TResult: core::marker::PhantomData::, TProgress: core::marker::PhantomData::, }; unsafe extern "system" fn QueryInterface( this: *mut core::ffi::c_void, iid: *const windows_core::GUID, interface: *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; if iid.is_null() || interface.is_null() { return windows_core::HRESULT(-2147467261); } * interface = if * iid == < AsyncOperationProgressHandler < TResult , TProgress > as windows_core::Interface >::IID || * iid == < windows_core::IUnknown as windows_core::Interface >::IID || * iid == < windows_core::imp::IAgileObject as windows_core::Interface >::IID { & mut ( * this ) . vtable as * mut _ as _ } else if * iid == < windows_core::imp::IMarshal as windows_core::Interface >::IID { ( * this ) . count . add_ref ( ) ; return windows_core::imp::marshaler ( core::mem::transmute ( & mut ( * this ) . vtable as * mut _ as * mut core::ffi::c_void ) , interface ) ; } else { core::ptr::null_mut ( ) } ; if (*interface).is_null() { windows_core::HRESULT(-2147467262) } else { (*this).count.add_ref(); windows_core::HRESULT(0) } } } unsafe extern "system" fn AddRef(this: *mut core::ffi::c_void) -> u32 { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; (*this).count.add_ref() } } unsafe extern "system" fn Release(this: *mut core::ffi::c_void) -> u32 { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { let _ = windows_core::imp::Box::from_raw(this); } remaining } } unsafe extern "system" fn Invoke( this: *mut core::ffi::c_void, asyncinfo: *mut core::ffi::c_void, progressinfo: windows_core::AbiType, ) -> windows_core::HRESULT { unsafe { let this = &mut *(this as *mut *mut core::ffi::c_void as *mut Self); (this.invoke)( core::mem::transmute_copy(&asyncinfo), core::mem::transmute_copy(&progressinfo), ) .into() } } } #[repr(transparent)] #[derive(Clone, Debug, Eq, PartialEq)] pub struct AsyncOperationWithProgressCompletedHandler( windows_core::IUnknown, core::marker::PhantomData, core::marker::PhantomData, ) where TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static; unsafe impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > windows_core::Interface for AsyncOperationWithProgressCompletedHandler { type Vtable = AsyncOperationWithProgressCompletedHandler_Vtbl; const IID: windows_core::GUID = windows_core::GUID::from_signature(::SIGNATURE); } impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > windows_core::RuntimeType for AsyncOperationWithProgressCompletedHandler { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new() .push_slice(b"pinterface({e85df41d-6aa7-46e3-a8e2-f009d840c627}") .push_slice(b";") .push_other(TResult::SIGNATURE) .push_slice(b";") .push_other(TProgress::SIGNATURE) .push_slice(b")"); } impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > AsyncOperationWithProgressCompletedHandler { pub fn new< F: Fn( windows_core::Ref>, AsyncStatus, ) -> windows_core::Result<()> + Send + 'static, >( invoke: F, ) -> Self { let com = AsyncOperationWithProgressCompletedHandlerBox { vtable: &AsyncOperationWithProgressCompletedHandlerBox::::VTABLE, count: windows_core::imp::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(windows_core::imp::Box::new(com)) } } pub fn Invoke(&self, asyncinfo: P0, asyncstatus: AsyncStatus) -> windows_core::Result<()> where P0: windows_core::Param>, { let this = self; unsafe { (windows_core::Interface::vtable(this).Invoke)( windows_core::Interface::as_raw(this), asyncinfo.param().abi(), asyncstatus, ) .ok() } } } #[repr(C)] #[doc(hidden)] pub struct AsyncOperationWithProgressCompletedHandler_Vtbl where TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, { base__: windows_core::IUnknown_Vtbl, Invoke: unsafe extern "system" fn( this: *mut core::ffi::c_void, asyncinfo: *mut core::ffi::c_void, asyncstatus: AsyncStatus, ) -> windows_core::HRESULT, TResult: core::marker::PhantomData, TProgress: core::marker::PhantomData, } #[repr(C)] struct AsyncOperationWithProgressCompletedHandlerBox< TResult, TProgress, F: Fn( windows_core::Ref>, AsyncStatus, ) -> windows_core::Result<()> + Send + 'static, > where TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, { vtable: *const AsyncOperationWithProgressCompletedHandler_Vtbl, invoke: F, count: windows_core::imp::RefCount, } impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, F: Fn( windows_core::Ref>, AsyncStatus, ) -> windows_core::Result<()> + Send + 'static, > AsyncOperationWithProgressCompletedHandlerBox { const VTABLE: AsyncOperationWithProgressCompletedHandler_Vtbl = AsyncOperationWithProgressCompletedHandler_Vtbl:: { base__: windows_core::IUnknown_Vtbl { QueryInterface: Self::QueryInterface, AddRef: Self::AddRef, Release: Self::Release, }, Invoke: Self::Invoke, TResult: core::marker::PhantomData::, TProgress: core::marker::PhantomData::, }; unsafe extern "system" fn QueryInterface( this: *mut core::ffi::c_void, iid: *const windows_core::GUID, interface: *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; if iid.is_null() || interface.is_null() { return windows_core::HRESULT(-2147467261); } * interface = if * iid == < AsyncOperationWithProgressCompletedHandler < TResult , TProgress > as windows_core::Interface >::IID || * iid == < windows_core::IUnknown as windows_core::Interface >::IID || * iid == < windows_core::imp::IAgileObject as windows_core::Interface >::IID { & mut ( * this ) . vtable as * mut _ as _ } else if * iid == < windows_core::imp::IMarshal as windows_core::Interface >::IID { ( * this ) . count . add_ref ( ) ; return windows_core::imp::marshaler ( core::mem::transmute ( & mut ( * this ) . vtable as * mut _ as * mut core::ffi::c_void ) , interface ) ; } else { core::ptr::null_mut ( ) } ; if (*interface).is_null() { windows_core::HRESULT(-2147467262) } else { (*this).count.add_ref(); windows_core::HRESULT(0) } } } unsafe extern "system" fn AddRef(this: *mut core::ffi::c_void) -> u32 { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; (*this).count.add_ref() } } unsafe extern "system" fn Release(this: *mut core::ffi::c_void) -> u32 { unsafe { let this = this as *mut *mut core::ffi::c_void as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { let _ = windows_core::imp::Box::from_raw(this); } remaining } } unsafe extern "system" fn Invoke( this: *mut core::ffi::c_void, asyncinfo: *mut core::ffi::c_void, asyncstatus: AsyncStatus, ) -> windows_core::HRESULT { unsafe { let this = &mut *(this as *mut *mut core::ffi::c_void as *mut Self); (this.invoke)(core::mem::transmute_copy(&asyncinfo), asyncstatus).into() } } } #[repr(transparent)] #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] pub struct AsyncStatus(pub i32); impl AsyncStatus { pub const Canceled: Self = Self(2i32); pub const Completed: Self = Self(1i32); pub const Error: Self = Self(3i32); pub const Started: Self = Self(0i32); } impl windows_core::TypeKind for AsyncStatus { type TypeKind = windows_core::CopyType; } impl windows_core::RuntimeType for AsyncStatus { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::from_slice(b"enum(Windows.Foundation.AsyncStatus;i4)"); } windows_core::imp::define_interface!( IAsyncAction, IAsyncAction_Vtbl, 0x5a648006_843a_4da9_865b_9d26e5dfad7b ); impl windows_core::RuntimeType for IAsyncAction { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_interface::(); } windows_core::imp::interface_hierarchy!( IAsyncAction, windows_core::IUnknown, windows_core::IInspectable ); windows_core::imp::required_hierarchy!(IAsyncAction, IAsyncInfo); impl IAsyncAction { pub fn SetCompleted(&self, handler: P0) -> windows_core::Result<()> where P0: windows_core::Param, { let this = self; unsafe { (windows_core::Interface::vtable(this).SetCompleted)( windows_core::Interface::as_raw(this), handler.param().abi(), ) .ok() } } pub fn Completed(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Completed)( windows_core::Interface::as_raw(this), &mut result__, ) .and_then(|| windows_core::Type::from_abi(result__)) } } pub fn GetResults(&self) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).GetResults)(windows_core::Interface::as_raw( this, )) .ok() } } pub fn Id(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Id)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Status(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Status)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn ErrorCode(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).ErrorCode)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Cancel(&self) -> windows_core::Result<()> { let this = &windows_core::Interface::cast::(self)?; unsafe { (windows_core::Interface::vtable(this).Cancel)(windows_core::Interface::as_raw(this)) .ok() } } pub fn Close(&self) -> windows_core::Result<()> { let this = &windows_core::Interface::cast::(self)?; unsafe { (windows_core::Interface::vtable(this).Close)(windows_core::Interface::as_raw(this)) .ok() } } } unsafe impl Send for IAsyncAction {} unsafe impl Sync for IAsyncAction {} impl windows_core::RuntimeName for IAsyncAction { const NAME: &'static str = "Windows.Foundation.IAsyncAction"; } pub trait IAsyncAction_Impl: IAsyncInfo_Impl { fn SetCompleted( &self, handler: windows_core::Ref, ) -> windows_core::Result<()>; fn Completed(&self) -> windows_core::Result; fn GetResults(&self) -> windows_core::Result<()>; } impl IAsyncAction_Vtbl { pub const fn new() -> Self { unsafe extern "system" fn SetCompleted( this: *mut core::ffi::c_void, handler: *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); IAsyncAction_Impl::SetCompleted(this, core::mem::transmute_copy(&handler)).into() } } unsafe extern "system" fn Completed( this: *mut core::ffi::c_void, result__: *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); match IAsyncAction_Impl::Completed(this) { Ok(ok__) => { result__.write(core::mem::transmute_copy(&ok__)); core::mem::forget(ok__); windows_core::HRESULT(0) } Err(err) => err.into(), } } } unsafe extern "system" fn GetResults( this: *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); IAsyncAction_Impl::GetResults(this).into() } } Self { base__: windows_core::IInspectable_Vtbl::new::(), SetCompleted: SetCompleted::, Completed: Completed::, GetResults: GetResults::, } } pub fn matches(iid: &windows_core::GUID) -> bool { iid == &::IID } } #[repr(C)] #[doc(hidden)] pub struct IAsyncAction_Vtbl { pub base__: windows_core::IInspectable_Vtbl, pub SetCompleted: unsafe extern "system" fn( *mut core::ffi::c_void, *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub Completed: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub GetResults: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT, } #[repr(transparent)] #[derive(Clone, Debug, Eq, PartialEq)] pub struct IAsyncActionWithProgress( windows_core::IUnknown, core::marker::PhantomData, ) where TProgress: windows_core::RuntimeType + 'static; impl windows_core::imp::CanInto for IAsyncActionWithProgress { } impl windows_core::imp::CanInto for IAsyncActionWithProgress { } unsafe impl windows_core::Interface for IAsyncActionWithProgress { type Vtable = IAsyncActionWithProgress_Vtbl; const IID: windows_core::GUID = windows_core::GUID::from_signature(::SIGNATURE); } impl windows_core::RuntimeType for IAsyncActionWithProgress { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new() .push_slice(b"pinterface({1f6db258-e803-48a1-9546-eb7353398884}") .push_slice(b";") .push_other(TProgress::SIGNATURE) .push_slice(b")"); } impl windows_core::imp::CanInto for IAsyncActionWithProgress { const QUERY: bool = true; } impl IAsyncActionWithProgress { pub fn SetProgress(&self, handler: P0) -> windows_core::Result<()> where P0: windows_core::Param>, { let this = self; unsafe { (windows_core::Interface::vtable(this).SetProgress)( windows_core::Interface::as_raw(this), handler.param().abi(), ) .ok() } } pub fn Progress(&self) -> windows_core::Result> { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Progress)( windows_core::Interface::as_raw(this), &mut result__, ) .and_then(|| windows_core::Type::from_abi(result__)) } } pub fn SetCompleted(&self, handler: P0) -> windows_core::Result<()> where P0: windows_core::Param>, { let this = self; unsafe { (windows_core::Interface::vtable(this).SetCompleted)( windows_core::Interface::as_raw(this), handler.param().abi(), ) .ok() } } pub fn Completed( &self, ) -> windows_core::Result> { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Completed)( windows_core::Interface::as_raw(this), &mut result__, ) .and_then(|| windows_core::Type::from_abi(result__)) } } pub fn GetResults(&self) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).GetResults)(windows_core::Interface::as_raw( this, )) .ok() } } pub fn Id(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Id)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Status(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Status)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn ErrorCode(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).ErrorCode)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Cancel(&self) -> windows_core::Result<()> { let this = &windows_core::Interface::cast::(self)?; unsafe { (windows_core::Interface::vtable(this).Cancel)(windows_core::Interface::as_raw(this)) .ok() } } pub fn Close(&self) -> windows_core::Result<()> { let this = &windows_core::Interface::cast::(self)?; unsafe { (windows_core::Interface::vtable(this).Close)(windows_core::Interface::as_raw(this)) .ok() } } } unsafe impl Send for IAsyncActionWithProgress { } unsafe impl Sync for IAsyncActionWithProgress { } impl windows_core::RuntimeName for IAsyncActionWithProgress { const NAME: &'static str = "Windows.Foundation.IAsyncActionWithProgress"; } pub trait IAsyncActionWithProgress_Impl: IAsyncInfo_Impl where TProgress: windows_core::RuntimeType + 'static, { fn SetProgress( &self, handler: windows_core::Ref>, ) -> windows_core::Result<()>; fn Progress(&self) -> windows_core::Result>; fn SetCompleted( &self, handler: windows_core::Ref>, ) -> windows_core::Result<()>; fn Completed(&self) -> windows_core::Result>; fn GetResults(&self) -> windows_core::Result<()>; } impl IAsyncActionWithProgress_Vtbl { pub const fn new, const OFFSET: isize>( ) -> Self { unsafe extern "system" fn SetProgress< TProgress: windows_core::RuntimeType + 'static, Identity: IAsyncActionWithProgress_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, handler: *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); IAsyncActionWithProgress_Impl::SetProgress( this, core::mem::transmute_copy(&handler), ) .into() } } unsafe extern "system" fn Progress< TProgress: windows_core::RuntimeType + 'static, Identity: IAsyncActionWithProgress_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, result__: *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); match IAsyncActionWithProgress_Impl::Progress(this) { Ok(ok__) => { result__.write(core::mem::transmute_copy(&ok__)); core::mem::forget(ok__); windows_core::HRESULT(0) } Err(err) => err.into(), } } } unsafe extern "system" fn SetCompleted< TProgress: windows_core::RuntimeType + 'static, Identity: IAsyncActionWithProgress_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, handler: *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); IAsyncActionWithProgress_Impl::SetCompleted( this, core::mem::transmute_copy(&handler), ) .into() } } unsafe extern "system" fn Completed< TProgress: windows_core::RuntimeType + 'static, Identity: IAsyncActionWithProgress_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, result__: *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); match IAsyncActionWithProgress_Impl::Completed(this) { Ok(ok__) => { result__.write(core::mem::transmute_copy(&ok__)); core::mem::forget(ok__); windows_core::HRESULT(0) } Err(err) => err.into(), } } } unsafe extern "system" fn GetResults< TProgress: windows_core::RuntimeType + 'static, Identity: IAsyncActionWithProgress_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); IAsyncActionWithProgress_Impl::GetResults(this).into() } } Self { base__: windows_core::IInspectable_Vtbl::new::< Identity, IAsyncActionWithProgress, OFFSET, >(), SetProgress: SetProgress::, Progress: Progress::, SetCompleted: SetCompleted::, Completed: Completed::, GetResults: GetResults::, TProgress: core::marker::PhantomData::, } } pub fn matches(iid: &windows_core::GUID) -> bool { iid == & as windows_core::Interface>::IID } } #[repr(C)] #[doc(hidden)] pub struct IAsyncActionWithProgress_Vtbl where TProgress: windows_core::RuntimeType + 'static, { pub base__: windows_core::IInspectable_Vtbl, pub SetProgress: unsafe extern "system" fn( *mut core::ffi::c_void, *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub Progress: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub SetCompleted: unsafe extern "system" fn( *mut core::ffi::c_void, *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub Completed: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub GetResults: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT, TProgress: core::marker::PhantomData, } windows_core::imp::define_interface!( IAsyncInfo, IAsyncInfo_Vtbl, 0x00000036_0000_0000_c000_000000000046 ); impl windows_core::RuntimeType for IAsyncInfo { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_interface::(); } windows_core::imp::interface_hierarchy!( IAsyncInfo, windows_core::IUnknown, windows_core::IInspectable ); impl IAsyncInfo { pub fn Id(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Id)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Status(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Status)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn ErrorCode(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).ErrorCode)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Cancel(&self) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).Cancel)(windows_core::Interface::as_raw(this)) .ok() } } pub fn Close(&self) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).Close)(windows_core::Interface::as_raw(this)) .ok() } } } impl windows_core::RuntimeName for IAsyncInfo { const NAME: &'static str = "Windows.Foundation.IAsyncInfo"; } pub trait IAsyncInfo_Impl: windows_core::IUnknownImpl { fn Id(&self) -> windows_core::Result; fn Status(&self) -> windows_core::Result; fn ErrorCode(&self) -> windows_core::Result; fn Cancel(&self) -> windows_core::Result<()>; fn Close(&self) -> windows_core::Result<()>; } impl IAsyncInfo_Vtbl { pub const fn new() -> Self { unsafe extern "system" fn Id( this: *mut core::ffi::c_void, result__: *mut u32, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); match IAsyncInfo_Impl::Id(this) { Ok(ok__) => { result__.write(core::mem::transmute_copy(&ok__)); windows_core::HRESULT(0) } Err(err) => err.into(), } } } unsafe extern "system" fn Status( this: *mut core::ffi::c_void, result__: *mut AsyncStatus, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); match IAsyncInfo_Impl::Status(this) { Ok(ok__) => { result__.write(core::mem::transmute_copy(&ok__)); windows_core::HRESULT(0) } Err(err) => err.into(), } } } unsafe extern "system" fn ErrorCode( this: *mut core::ffi::c_void, result__: *mut windows_core::HRESULT, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); match IAsyncInfo_Impl::ErrorCode(this) { Ok(ok__) => { result__.write(core::mem::transmute_copy(&ok__)); windows_core::HRESULT(0) } Err(err) => err.into(), } } } unsafe extern "system" fn Cancel( this: *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); IAsyncInfo_Impl::Cancel(this).into() } } unsafe extern "system" fn Close( this: *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); IAsyncInfo_Impl::Close(this).into() } } Self { base__: windows_core::IInspectable_Vtbl::new::(), Id: Id::, Status: Status::, ErrorCode: ErrorCode::, Cancel: Cancel::, Close: Close::, } } pub fn matches(iid: &windows_core::GUID) -> bool { iid == &::IID } } #[repr(C)] #[doc(hidden)] pub struct IAsyncInfo_Vtbl { pub base__: windows_core::IInspectable_Vtbl, pub Id: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT, pub Status: unsafe extern "system" fn( *mut core::ffi::c_void, *mut AsyncStatus, ) -> windows_core::HRESULT, pub ErrorCode: unsafe extern "system" fn( *mut core::ffi::c_void, *mut windows_core::HRESULT, ) -> windows_core::HRESULT, pub Cancel: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT, pub Close: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT, } #[repr(transparent)] #[derive(Clone, Debug, Eq, PartialEq)] pub struct IAsyncOperation(windows_core::IUnknown, core::marker::PhantomData) where TResult: windows_core::RuntimeType + 'static; impl windows_core::imp::CanInto for IAsyncOperation { } impl windows_core::imp::CanInto for IAsyncOperation { } unsafe impl windows_core::Interface for IAsyncOperation { type Vtable = IAsyncOperation_Vtbl; const IID: windows_core::GUID = windows_core::GUID::from_signature(::SIGNATURE); } impl windows_core::RuntimeType for IAsyncOperation { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new() .push_slice(b"pinterface({9fc2b0bb-e446-44e2-aa61-9cab8f636af2}") .push_slice(b";") .push_other(TResult::SIGNATURE) .push_slice(b")"); } impl windows_core::imp::CanInto for IAsyncOperation { const QUERY: bool = true; } impl IAsyncOperation { pub fn SetCompleted(&self, handler: P0) -> windows_core::Result<()> where P0: windows_core::Param>, { let this = self; unsafe { (windows_core::Interface::vtable(this).SetCompleted)( windows_core::Interface::as_raw(this), handler.param().abi(), ) .ok() } } pub fn Completed(&self) -> windows_core::Result> { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Completed)( windows_core::Interface::as_raw(this), &mut result__, ) .and_then(|| windows_core::Type::from_abi(result__)) } } pub fn GetResults(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).GetResults)( windows_core::Interface::as_raw(this), &mut result__, ) .and_then(|| windows_core::Type::from_abi(result__)) } } pub fn Id(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Id)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Status(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Status)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn ErrorCode(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).ErrorCode)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Cancel(&self) -> windows_core::Result<()> { let this = &windows_core::Interface::cast::(self)?; unsafe { (windows_core::Interface::vtable(this).Cancel)(windows_core::Interface::as_raw(this)) .ok() } } pub fn Close(&self) -> windows_core::Result<()> { let this = &windows_core::Interface::cast::(self)?; unsafe { (windows_core::Interface::vtable(this).Close)(windows_core::Interface::as_raw(this)) .ok() } } } unsafe impl Send for IAsyncOperation {} unsafe impl Sync for IAsyncOperation {} impl windows_core::RuntimeName for IAsyncOperation { const NAME: &'static str = "Windows.Foundation.IAsyncOperation"; } pub trait IAsyncOperation_Impl: IAsyncInfo_Impl where TResult: windows_core::RuntimeType + 'static, { fn SetCompleted( &self, handler: windows_core::Ref>, ) -> windows_core::Result<()>; fn Completed(&self) -> windows_core::Result>; fn GetResults(&self) -> windows_core::Result; } impl IAsyncOperation_Vtbl { pub const fn new, const OFFSET: isize>() -> Self { unsafe extern "system" fn SetCompleted< TResult: windows_core::RuntimeType + 'static, Identity: IAsyncOperation_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, handler: *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); IAsyncOperation_Impl::SetCompleted(this, core::mem::transmute_copy(&handler)).into() } } unsafe extern "system" fn Completed< TResult: windows_core::RuntimeType + 'static, Identity: IAsyncOperation_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, result__: *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); match IAsyncOperation_Impl::Completed(this) { Ok(ok__) => { result__.write(core::mem::transmute_copy(&ok__)); core::mem::forget(ok__); windows_core::HRESULT(0) } Err(err) => err.into(), } } } unsafe extern "system" fn GetResults< TResult: windows_core::RuntimeType + 'static, Identity: IAsyncOperation_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, result__: *mut windows_core::AbiType, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); match IAsyncOperation_Impl::GetResults(this) { Ok(ok__) => { result__.write(core::mem::transmute_copy(&ok__)); core::mem::forget(ok__); windows_core::HRESULT(0) } Err(err) => err.into(), } } } Self { base__: windows_core::IInspectable_Vtbl::new::< Identity, IAsyncOperation, OFFSET, >(), SetCompleted: SetCompleted::, Completed: Completed::, GetResults: GetResults::, TResult: core::marker::PhantomData::, } } pub fn matches(iid: &windows_core::GUID) -> bool { iid == & as windows_core::Interface>::IID } } #[repr(C)] #[doc(hidden)] pub struct IAsyncOperation_Vtbl where TResult: windows_core::RuntimeType + 'static, { pub base__: windows_core::IInspectable_Vtbl, pub SetCompleted: unsafe extern "system" fn( *mut core::ffi::c_void, *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub Completed: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub GetResults: unsafe extern "system" fn( *mut core::ffi::c_void, *mut windows_core::AbiType, ) -> windows_core::HRESULT, TResult: core::marker::PhantomData, } #[repr(transparent)] #[derive(Clone, Debug, Eq, PartialEq)] pub struct IAsyncOperationWithProgress( windows_core::IUnknown, core::marker::PhantomData, core::marker::PhantomData, ) where TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static; impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > windows_core::imp::CanInto for IAsyncOperationWithProgress { } impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > windows_core::imp::CanInto for IAsyncOperationWithProgress { } unsafe impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > windows_core::Interface for IAsyncOperationWithProgress { type Vtable = IAsyncOperationWithProgress_Vtbl; const IID: windows_core::GUID = windows_core::GUID::from_signature(::SIGNATURE); } impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > windows_core::RuntimeType for IAsyncOperationWithProgress { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::new() .push_slice(b"pinterface({b5d036d7-e297-498f-ba60-0289e76e23dd}") .push_slice(b";") .push_other(TResult::SIGNATURE) .push_slice(b";") .push_other(TProgress::SIGNATURE) .push_slice(b")"); } impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > windows_core::imp::CanInto for IAsyncOperationWithProgress { const QUERY: bool = true; } impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > IAsyncOperationWithProgress { pub fn SetProgress(&self, handler: P0) -> windows_core::Result<()> where P0: windows_core::Param>, { let this = self; unsafe { (windows_core::Interface::vtable(this).SetProgress)( windows_core::Interface::as_raw(this), handler.param().abi(), ) .ok() } } pub fn Progress( &self, ) -> windows_core::Result> { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Progress)( windows_core::Interface::as_raw(this), &mut result__, ) .and_then(|| windows_core::Type::from_abi(result__)) } } pub fn SetCompleted(&self, handler: P0) -> windows_core::Result<()> where P0: windows_core::Param>, { let this = self; unsafe { (windows_core::Interface::vtable(this).SetCompleted)( windows_core::Interface::as_raw(this), handler.param().abi(), ) .ok() } } pub fn Completed( &self, ) -> windows_core::Result> { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Completed)( windows_core::Interface::as_raw(this), &mut result__, ) .and_then(|| windows_core::Type::from_abi(result__)) } } pub fn GetResults(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).GetResults)( windows_core::Interface::as_raw(this), &mut result__, ) .and_then(|| windows_core::Type::from_abi(result__)) } } pub fn Id(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Id)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Status(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Status)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn ErrorCode(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).ErrorCode)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Cancel(&self) -> windows_core::Result<()> { let this = &windows_core::Interface::cast::(self)?; unsafe { (windows_core::Interface::vtable(this).Cancel)(windows_core::Interface::as_raw(this)) .ok() } } pub fn Close(&self) -> windows_core::Result<()> { let this = &windows_core::Interface::cast::(self)?; unsafe { (windows_core::Interface::vtable(this).Close)(windows_core::Interface::as_raw(this)) .ok() } } } unsafe impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > Send for IAsyncOperationWithProgress { } unsafe impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > Sync for IAsyncOperationWithProgress { } impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > windows_core::RuntimeName for IAsyncOperationWithProgress { const NAME: &'static str = "Windows.Foundation.IAsyncOperationWithProgress"; } pub trait IAsyncOperationWithProgress_Impl: IAsyncInfo_Impl where TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, { fn SetProgress( &self, handler: windows_core::Ref>, ) -> windows_core::Result<()>; fn Progress(&self) -> windows_core::Result>; fn SetCompleted( &self, handler: windows_core::Ref>, ) -> windows_core::Result<()>; fn Completed( &self, ) -> windows_core::Result>; fn GetResults(&self) -> windows_core::Result; } impl< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, > IAsyncOperationWithProgress_Vtbl { pub const fn new< Identity: IAsyncOperationWithProgress_Impl, const OFFSET: isize, >() -> Self { unsafe extern "system" fn SetProgress< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, Identity: IAsyncOperationWithProgress_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, handler: *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); IAsyncOperationWithProgress_Impl::SetProgress( this, core::mem::transmute_copy(&handler), ) .into() } } unsafe extern "system" fn Progress< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, Identity: IAsyncOperationWithProgress_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, result__: *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); match IAsyncOperationWithProgress_Impl::Progress(this) { Ok(ok__) => { result__.write(core::mem::transmute_copy(&ok__)); core::mem::forget(ok__); windows_core::HRESULT(0) } Err(err) => err.into(), } } } unsafe extern "system" fn SetCompleted< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, Identity: IAsyncOperationWithProgress_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, handler: *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); IAsyncOperationWithProgress_Impl::SetCompleted( this, core::mem::transmute_copy(&handler), ) .into() } } unsafe extern "system" fn Completed< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, Identity: IAsyncOperationWithProgress_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, result__: *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); match IAsyncOperationWithProgress_Impl::Completed(this) { Ok(ok__) => { result__.write(core::mem::transmute_copy(&ok__)); core::mem::forget(ok__); windows_core::HRESULT(0) } Err(err) => err.into(), } } } unsafe extern "system" fn GetResults< TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, Identity: IAsyncOperationWithProgress_Impl, const OFFSET: isize, >( this: *mut core::ffi::c_void, result__: *mut windows_core::AbiType, ) -> windows_core::HRESULT { unsafe { let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); match IAsyncOperationWithProgress_Impl::GetResults(this) { Ok(ok__) => { result__.write(core::mem::transmute_copy(&ok__)); core::mem::forget(ok__); windows_core::HRESULT(0) } Err(err) => err.into(), } } } Self { base__: windows_core::IInspectable_Vtbl::new::< Identity, IAsyncOperationWithProgress, OFFSET, >(), SetProgress: SetProgress::, Progress: Progress::, SetCompleted: SetCompleted::, Completed: Completed::, GetResults: GetResults::, TResult: core::marker::PhantomData::, TProgress: core::marker::PhantomData::, } } pub fn matches(iid: &windows_core::GUID) -> bool { iid == & as windows_core::Interface>::IID } } #[repr(C)] #[doc(hidden)] pub struct IAsyncOperationWithProgress_Vtbl where TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static, { pub base__: windows_core::IInspectable_Vtbl, pub SetProgress: unsafe extern "system" fn( *mut core::ffi::c_void, *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub Progress: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub SetCompleted: unsafe extern "system" fn( *mut core::ffi::c_void, *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub Completed: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub GetResults: unsafe extern "system" fn( *mut core::ffi::c_void, *mut windows_core::AbiType, ) -> windows_core::HRESULT, TResult: core::marker::PhantomData, TProgress: core::marker::PhantomData, }