1 | use crate::ComInterface; |
2 | |
3 | // A streamlined version of the IActivationFactory interface used by WinRT class factories used internally by the windows crate |
4 | // to simplify code generation. Components should implement the `IActivationFactory` interface published by the windows crate. |
5 | #[repr (transparent)] |
6 | #[derive (Clone, PartialEq, Eq)] |
7 | pub struct IGenericFactory(crate::IUnknown); |
8 | |
9 | impl IGenericFactory { |
10 | pub fn ActivateInstance<I: crate::ComInterface>(&self) -> crate::Result<I> { |
11 | unsafe { |
12 | let mut result__: *mut c_void = std::mem::zeroed(); |
13 | (crate::Interface::vtable(self).ActivateInstance)(std::mem::transmute_copy(self), &mut result__ as *mut _ as *mut _).from_abi::<crate::IInspectable>(result__)?.cast() |
14 | } |
15 | } |
16 | } |
17 | |
18 | #[repr (C)] |
19 | pub struct IGenericFactory_Vtbl { |
20 | pub base__: crate::IInspectable_Vtbl, |
21 | pub ActivateInstance: unsafe extern "system" fn(this: *mut std::ffi::c_void, instance: *mut *mut std::ffi::c_void) -> crate::HRESULT, |
22 | } |
23 | |
24 | unsafe impl crate::Interface for IGenericFactory { |
25 | type Vtable = IGenericFactory_Vtbl; |
26 | } |
27 | |
28 | unsafe impl crate::ComInterface for IGenericFactory { |
29 | const IID: crate::GUID = crate::GUID::from_u128(uuid:0x00000035_0000_0000_c000_000000000046); |
30 | } |
31 | |