From 94c1cb3187a744244b0a4b1dc39afdea6ee5568a Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Tue, 29 Oct 2024 15:17:39 -0500 Subject: [PATCH] tests and samples --- .../json_validator_winrt/Cargo.toml | 1 - .../json_validator_winrt/src/bindings.rs | 146 ++++---- crates/samples/windows/bits/Cargo.toml | 1 - crates/samples/windows/core_app/Cargo.toml | 1 - crates/tests/misc/async/Cargo.toml | 1 - crates/tests/misc/component/Cargo.toml | 1 - crates/tests/misc/component/src/bindings.rs | 322 ++++++++-------- crates/tests/misc/component_client/Cargo.toml | 1 - crates/tests/misc/core/Cargo.toml | 1 - .../tests/misc/debugger_visualizer/Cargo.toml | 1 - crates/tests/misc/error/Cargo.toml | 1 - crates/tests/misc/implement/Cargo.toml | 1 - crates/tests/misc/interface/Cargo.toml | 1 - crates/tests/misc/no_std/Cargo.toml | 1 - crates/tests/misc/no_use/Cargo.toml | 1 - crates/tests/misc/structs/Cargo.toml | 1 - crates/tests/winrt/collections/Cargo.toml | 1 - crates/tests/winrt/composable/Cargo.toml | 1 - crates/tests/winrt/composable/src/bindings.rs | 338 ++++++++--------- .../tests/winrt/composable_client/Cargo.toml | 1 - crates/tests/winrt/constructors/Cargo.toml | 1 - .../tests/winrt/constructors/src/bindings.rs | 346 +++++++++--------- .../winrt/constructors_client/Cargo.toml | 1 - crates/tests/winrt/old/Cargo.toml | 1 - crates/tests/winrt/reference_float/Cargo.toml | 1 - 25 files changed, 576 insertions(+), 597 deletions(-) diff --git a/crates/samples/components/json_validator_winrt/Cargo.toml b/crates/samples/components/json_validator_winrt/Cargo.toml index c5104e817c..0fabf0ad8a 100644 --- a/crates/samples/components/json_validator_winrt/Cargo.toml +++ b/crates/samples/components/json_validator_winrt/Cargo.toml @@ -15,7 +15,6 @@ serde_json = {version = "1.0", default-features = false } [dependencies.windows] workspace = true features = [ - "implement", "Win32_System_WinRT", ] diff --git a/crates/samples/components/json_validator_winrt/src/bindings.rs b/crates/samples/components/json_validator_winrt/src/bindings.rs index 76e7cb2ec1..f94a20373b 100644 --- a/crates/samples/components/json_validator_winrt/src/bindings.rs +++ b/crates/samples/components/json_validator_winrt/src/bindings.rs @@ -25,6 +25,41 @@ pub struct IJsonValidator_Vtbl { *mut core::mem::MaybeUninit, ) -> windows_core::HRESULT, } +pub trait IJsonValidator_Impl: Sized + windows_core::IUnknownImpl { + fn Validate( + &self, + value: &windows_core::HSTRING, + ) -> windows_core::Result; +} +impl windows_core::RuntimeName for IJsonValidator { + const NAME: &'static str = "Sample.IJsonValidator"; +} +impl IJsonValidator_Vtbl { + pub const fn new() -> IJsonValidator_Vtbl { + unsafe extern "system" fn Validate( + this: *mut core::ffi::c_void, + value: core::mem::MaybeUninit, + result__: *mut core::mem::MaybeUninit, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IJsonValidator_Impl::Validate(this, core::mem::transmute(&value)) { + 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::(), + Validate: Validate::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} windows_core::imp::define_interface!( IJsonValidatorFactory, IJsonValidatorFactory_Vtbl, @@ -43,6 +78,44 @@ pub struct IJsonValidatorFactory_Vtbl { *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, } +pub trait IJsonValidatorFactory_Impl: Sized + windows_core::IUnknownImpl { + fn CreateInstance(&self, schema: &windows_core::HSTRING) + -> windows_core::Result; +} +impl windows_core::RuntimeName for IJsonValidatorFactory { + const NAME: &'static str = "Sample.IJsonValidatorFactory"; +} +impl IJsonValidatorFactory_Vtbl { + pub const fn new( + ) -> IJsonValidatorFactory_Vtbl { + unsafe extern "system" fn CreateInstance< + Identity: IJsonValidatorFactory_Impl, + const OFFSET: isize, + >( + this: *mut core::ffi::c_void, + schema: core::mem::MaybeUninit, + result__: *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IJsonValidatorFactory_Impl::CreateInstance(this, core::mem::transmute(&schema)) { + 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::( + ), + CreateInstance: CreateInstance::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} #[repr(transparent)] #[derive(PartialEq, Eq, Debug, Clone)] pub struct JsonValidator(windows_core::IUnknown); @@ -99,76 +172,3 @@ impl windows_core::RuntimeName for JsonValidator { } unsafe impl Send for JsonValidator {} unsafe impl Sync for JsonValidator {} -pub trait IJsonValidator_Impl: Sized + windows_core::IUnknownImpl { - fn Validate( - &self, - value: &windows_core::HSTRING, - ) -> windows_core::Result; -} -impl windows_core::RuntimeName for IJsonValidator { - const NAME: &'static str = "Sample.IJsonValidator"; -} -impl IJsonValidator_Vtbl { - pub const fn new() -> IJsonValidator_Vtbl { - unsafe extern "system" fn Validate( - this: *mut core::ffi::c_void, - value: core::mem::MaybeUninit, - result__: *mut core::mem::MaybeUninit, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IJsonValidator_Impl::Validate(this, core::mem::transmute(&value)) { - 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::(), - Validate: Validate::, - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} -pub trait IJsonValidatorFactory_Impl: Sized + windows_core::IUnknownImpl { - fn CreateInstance(&self, schema: &windows_core::HSTRING) - -> windows_core::Result; -} -impl windows_core::RuntimeName for IJsonValidatorFactory { - const NAME: &'static str = "Sample.IJsonValidatorFactory"; -} -impl IJsonValidatorFactory_Vtbl { - pub const fn new( - ) -> IJsonValidatorFactory_Vtbl { - unsafe extern "system" fn CreateInstance< - Identity: IJsonValidatorFactory_Impl, - const OFFSET: isize, - >( - this: *mut core::ffi::c_void, - schema: core::mem::MaybeUninit, - result__: *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IJsonValidatorFactory_Impl::CreateInstance(this, core::mem::transmute(&schema)) { - 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::( - ), - CreateInstance: CreateInstance::, - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} diff --git a/crates/samples/windows/bits/Cargo.toml b/crates/samples/windows/bits/Cargo.toml index bb9dc05b75..a7beaa53fd 100644 --- a/crates/samples/windows/bits/Cargo.toml +++ b/crates/samples/windows/bits/Cargo.toml @@ -7,7 +7,6 @@ publish = false [dependencies.windows] workspace = true features = [ - "implement", "Win32_System_Com", "Win32_Networking_BackgroundIntelligentTransferService", ] diff --git a/crates/samples/windows/core_app/Cargo.toml b/crates/samples/windows/core_app/Cargo.toml index d0e93d5046..36e4403bd9 100644 --- a/crates/samples/windows/core_app/Cargo.toml +++ b/crates/samples/windows/core_app/Cargo.toml @@ -7,7 +7,6 @@ publish = false [dependencies.windows] workspace = true features = [ - "implement", "ApplicationModel_Core", "UI_Core", "Win32_Storage_Packaging_Appx", diff --git a/crates/tests/misc/async/Cargo.toml b/crates/tests/misc/async/Cargo.toml index f86fc5a082..0a68150898 100644 --- a/crates/tests/misc/async/Cargo.toml +++ b/crates/tests/misc/async/Cargo.toml @@ -11,7 +11,6 @@ doctest = false [dependencies.windows] workspace = true features = [ - "implement", "Storage_Streams", "System_Threading", "Win32_Foundation", diff --git a/crates/tests/misc/component/Cargo.toml b/crates/tests/misc/component/Cargo.toml index 8e5abf7635..d9bc11a192 100644 --- a/crates/tests/misc/component/Cargo.toml +++ b/crates/tests/misc/component/Cargo.toml @@ -15,7 +15,6 @@ workspace = true [dependencies.windows] workspace = true features = [ - "implement", "Foundation", "Win32_System_WinRT", ] diff --git a/crates/tests/misc/component/src/bindings.rs b/crates/tests/misc/component/src/bindings.rs index a3729f3de0..32f9c4f397 100644 --- a/crates/tests/misc/component/src/bindings.rs +++ b/crates/tests/misc/component/src/bindings.rs @@ -111,6 +111,167 @@ pub struct IClass_Vtbl { *mut core::ffi::c_void, ) -> windows_core::HRESULT, } +pub trait IClass_Impl: Sized + windows_core::IUnknownImpl { + fn Property(&self) -> windows_core::Result; + fn SetProperty(&self, value: i32) -> windows_core::Result<()>; + fn Flags(&self) -> windows_core::Result; + fn Int32Array( + &self, + a: &[i32], + b: &mut [i32], + c: &mut windows_core::Array, + ) -> windows_core::Result>; + fn StringArray( + &self, + a: &[windows_core::HSTRING], + b: &mut [windows_core::HSTRING], + c: &mut windows_core::Array, + ) -> windows_core::Result>; + fn Input( + &self, + a: Option<&windows_core::IInspectable>, + b: Option<&Class>, + c: Option<&windows::Foundation::IStringable>, + d: Option<&Callback>, + ) -> windows_core::Result<()>; +} +impl windows_core::RuntimeName for IClass { + const NAME: &'static str = "test_component.IClass"; +} +impl IClass_Vtbl { + pub const fn new() -> IClass_Vtbl { + unsafe extern "system" fn Property( + this: *mut core::ffi::c_void, + result__: *mut i32, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IClass_Impl::Property(this) { + Ok(ok__) => { + result__.write(core::mem::transmute_copy(&ok__)); + windows_core::HRESULT(0) + } + Err(err) => err.into(), + } + } + unsafe extern "system" fn SetProperty( + this: *mut core::ffi::c_void, + value: i32, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + IClass_Impl::SetProperty(this, value).into() + } + unsafe extern "system" fn Flags( + this: *mut core::ffi::c_void, + result__: *mut Flags, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IClass_Impl::Flags(this) { + Ok(ok__) => { + result__.write(core::mem::transmute_copy(&ok__)); + windows_core::HRESULT(0) + } + Err(err) => err.into(), + } + } + unsafe extern "system" fn Int32Array( + this: *mut core::ffi::c_void, + a_array_size: u32, + a: *const i32, + b_array_size: u32, + b: *mut i32, + c_array_size: *mut u32, + c: *mut *mut i32, + result_size__: *mut u32, + result__: *mut *mut i32, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IClass_Impl::Int32Array( + this, + core::slice::from_raw_parts(core::mem::transmute_copy(&a), a_array_size as usize), + core::slice::from_raw_parts_mut( + core::mem::transmute_copy(&b), + b_array_size as usize, + ), + windows_core::ArrayProxy::from_raw_parts( + core::mem::transmute_copy(&c), + c_array_size, + ) + .as_array(), + ) { + Ok(ok__) => { + let (ok_data__, ok_data_len__) = ok__.into_abi(); + result__.write(ok_data__); + result_size__.write(ok_data_len__); + windows_core::HRESULT(0) + } + Err(err) => err.into(), + } + } + unsafe extern "system" fn StringArray( + this: *mut core::ffi::c_void, + a_array_size: u32, + a: *const core::mem::MaybeUninit, + b_array_size: u32, + b: *mut core::mem::MaybeUninit, + c_array_size: *mut u32, + c: *mut *mut core::mem::MaybeUninit, + result_size__: *mut u32, + result__: *mut *mut core::mem::MaybeUninit, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IClass_Impl::StringArray( + this, + core::slice::from_raw_parts(core::mem::transmute_copy(&a), a_array_size as usize), + core::slice::from_raw_parts_mut( + core::mem::transmute_copy(&b), + b_array_size as usize, + ), + windows_core::ArrayProxy::from_raw_parts( + core::mem::transmute_copy(&c), + c_array_size, + ) + .as_array(), + ) { + Ok(ok__) => { + let (ok_data__, ok_data_len__) = ok__.into_abi(); + result__.write(ok_data__); + result_size__.write(ok_data_len__); + windows_core::HRESULT(0) + } + Err(err) => err.into(), + } + } + unsafe extern "system" fn Input( + this: *mut core::ffi::c_void, + a: *mut core::ffi::c_void, + b: *mut core::ffi::c_void, + c: *mut core::ffi::c_void, + d: *mut core::ffi::c_void, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + IClass_Impl::Input( + this, + windows_core::from_raw_borrowed(&a), + windows_core::from_raw_borrowed(&b), + windows_core::from_raw_borrowed(&c), + windows_core::from_raw_borrowed(&d), + ) + .into() + } + Self { + base__: windows_core::IInspectable_Vtbl::new::(), + Property: Property::, + SetProperty: SetProperty::, + Flags: Flags::, + Int32Array: Int32Array::, + StringArray: StringArray::, + Input: Input::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} #[repr(transparent)] #[derive(PartialEq, Eq, Debug, Clone)] pub struct Class(windows_core::IUnknown); @@ -396,164 +557,3 @@ pub struct Callback_Vtbl { pub Invoke: unsafe extern "system" fn(*mut core::ffi::c_void, i32, *mut i32) -> windows_core::HRESULT, } -pub trait IClass_Impl: Sized + windows_core::IUnknownImpl { - fn Property(&self) -> windows_core::Result; - fn SetProperty(&self, value: i32) -> windows_core::Result<()>; - fn Flags(&self) -> windows_core::Result; - fn Int32Array( - &self, - a: &[i32], - b: &mut [i32], - c: &mut windows_core::Array, - ) -> windows_core::Result>; - fn StringArray( - &self, - a: &[windows_core::HSTRING], - b: &mut [windows_core::HSTRING], - c: &mut windows_core::Array, - ) -> windows_core::Result>; - fn Input( - &self, - a: Option<&windows_core::IInspectable>, - b: Option<&Class>, - c: Option<&windows::Foundation::IStringable>, - d: Option<&Callback>, - ) -> windows_core::Result<()>; -} -impl windows_core::RuntimeName for IClass { - const NAME: &'static str = "test_component.IClass"; -} -impl IClass_Vtbl { - pub const fn new() -> IClass_Vtbl { - unsafe extern "system" fn Property( - this: *mut core::ffi::c_void, - result__: *mut i32, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IClass_Impl::Property(this) { - Ok(ok__) => { - result__.write(core::mem::transmute_copy(&ok__)); - windows_core::HRESULT(0) - } - Err(err) => err.into(), - } - } - unsafe extern "system" fn SetProperty( - this: *mut core::ffi::c_void, - value: i32, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - IClass_Impl::SetProperty(this, value).into() - } - unsafe extern "system" fn Flags( - this: *mut core::ffi::c_void, - result__: *mut Flags, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IClass_Impl::Flags(this) { - Ok(ok__) => { - result__.write(core::mem::transmute_copy(&ok__)); - windows_core::HRESULT(0) - } - Err(err) => err.into(), - } - } - unsafe extern "system" fn Int32Array( - this: *mut core::ffi::c_void, - a_array_size: u32, - a: *const i32, - b_array_size: u32, - b: *mut i32, - c_array_size: *mut u32, - c: *mut *mut i32, - result_size__: *mut u32, - result__: *mut *mut i32, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IClass_Impl::Int32Array( - this, - core::slice::from_raw_parts(core::mem::transmute_copy(&a), a_array_size as usize), - core::slice::from_raw_parts_mut( - core::mem::transmute_copy(&b), - b_array_size as usize, - ), - windows_core::ArrayProxy::from_raw_parts( - core::mem::transmute_copy(&c), - c_array_size, - ) - .as_array(), - ) { - Ok(ok__) => { - let (ok_data__, ok_data_len__) = ok__.into_abi(); - result__.write(ok_data__); - result_size__.write(ok_data_len__); - windows_core::HRESULT(0) - } - Err(err) => err.into(), - } - } - unsafe extern "system" fn StringArray( - this: *mut core::ffi::c_void, - a_array_size: u32, - a: *const core::mem::MaybeUninit, - b_array_size: u32, - b: *mut core::mem::MaybeUninit, - c_array_size: *mut u32, - c: *mut *mut core::mem::MaybeUninit, - result_size__: *mut u32, - result__: *mut *mut core::mem::MaybeUninit, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IClass_Impl::StringArray( - this, - core::slice::from_raw_parts(core::mem::transmute_copy(&a), a_array_size as usize), - core::slice::from_raw_parts_mut( - core::mem::transmute_copy(&b), - b_array_size as usize, - ), - windows_core::ArrayProxy::from_raw_parts( - core::mem::transmute_copy(&c), - c_array_size, - ) - .as_array(), - ) { - Ok(ok__) => { - let (ok_data__, ok_data_len__) = ok__.into_abi(); - result__.write(ok_data__); - result_size__.write(ok_data_len__); - windows_core::HRESULT(0) - } - Err(err) => err.into(), - } - } - unsafe extern "system" fn Input( - this: *mut core::ffi::c_void, - a: *mut core::ffi::c_void, - b: *mut core::ffi::c_void, - c: *mut core::ffi::c_void, - d: *mut core::ffi::c_void, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - IClass_Impl::Input( - this, - windows_core::from_raw_borrowed(&a), - windows_core::from_raw_borrowed(&b), - windows_core::from_raw_borrowed(&c), - windows_core::from_raw_borrowed(&d), - ) - .into() - } - Self { - base__: windows_core::IInspectable_Vtbl::new::(), - Property: Property::, - SetProperty: SetProperty::, - Flags: Flags::, - Int32Array: Int32Array::, - StringArray: StringArray::, - Input: Input::, - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} diff --git a/crates/tests/misc/component_client/Cargo.toml b/crates/tests/misc/component_client/Cargo.toml index 49ce93ac0f..386c98b909 100644 --- a/crates/tests/misc/component_client/Cargo.toml +++ b/crates/tests/misc/component_client/Cargo.toml @@ -17,7 +17,6 @@ workspace = true [dependencies.windows] workspace = true features = [ - "implement", "Foundation", "Win32_Foundation", ] diff --git a/crates/tests/misc/core/Cargo.toml b/crates/tests/misc/core/Cargo.toml index 47e98432a7..a21a133c56 100644 --- a/crates/tests/misc/core/Cargo.toml +++ b/crates/tests/misc/core/Cargo.toml @@ -11,7 +11,6 @@ doctest = false [dependencies.windows] workspace = true features = [ - "implement", "Win32_System_WinRT", "Win32_System_Ole", "Win32_System_Com", diff --git a/crates/tests/misc/debugger_visualizer/Cargo.toml b/crates/tests/misc/debugger_visualizer/Cargo.toml index 3cf9b41356..82bad675cf 100644 --- a/crates/tests/misc/debugger_visualizer/Cargo.toml +++ b/crates/tests/misc/debugger_visualizer/Cargo.toml @@ -14,7 +14,6 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(windows_debugger_visualize [dependencies.windows] workspace = true features = [ - "implement", "Win32_System_Com", ] diff --git a/crates/tests/misc/error/Cargo.toml b/crates/tests/misc/error/Cargo.toml index 6279f20cd1..76ca2909b2 100644 --- a/crates/tests/misc/error/Cargo.toml +++ b/crates/tests/misc/error/Cargo.toml @@ -11,7 +11,6 @@ doctest = false [dependencies.windows] workspace = true features = [ - "implement", "Foundation", "Win32_System_Rpc", ] diff --git a/crates/tests/misc/implement/Cargo.toml b/crates/tests/misc/implement/Cargo.toml index 545fd9d6b4..8afbcdbc35 100644 --- a/crates/tests/misc/implement/Cargo.toml +++ b/crates/tests/misc/implement/Cargo.toml @@ -11,7 +11,6 @@ doctest = false [dependencies.windows] workspace = true features = [ - "implement", "ApplicationModel_Activation", "ApplicationModel_Background", "Foundation_Collections", diff --git a/crates/tests/misc/interface/Cargo.toml b/crates/tests/misc/interface/Cargo.toml index 26124b4af4..ae5406b423 100644 --- a/crates/tests/misc/interface/Cargo.toml +++ b/crates/tests/misc/interface/Cargo.toml @@ -11,7 +11,6 @@ doctest = false [dependencies.windows] workspace = true features = [ - "implement", "Win32_Graphics_Direct3D", "Win32_Graphics_Direct3D10", "Win32_Graphics_Direct3D12", diff --git a/crates/tests/misc/no_std/Cargo.toml b/crates/tests/misc/no_std/Cargo.toml index 5181b6649c..87d748c9ae 100644 --- a/crates/tests/misc/no_std/Cargo.toml +++ b/crates/tests/misc/no_std/Cargo.toml @@ -37,7 +37,6 @@ default-features = false [dependencies.windows] path = "../../../libs/windows" default-features = false -features = ["implement"] [lints] workspace = true diff --git a/crates/tests/misc/no_use/Cargo.toml b/crates/tests/misc/no_use/Cargo.toml index 145fb8e4ae..608acbdda1 100644 --- a/crates/tests/misc/no_use/Cargo.toml +++ b/crates/tests/misc/no_use/Cargo.toml @@ -11,7 +11,6 @@ doctest = false [dependencies.windows] workspace = true features = [ - "implement", "Foundation", ] diff --git a/crates/tests/misc/structs/Cargo.toml b/crates/tests/misc/structs/Cargo.toml index 68fe573798..774f224a05 100644 --- a/crates/tests/misc/structs/Cargo.toml +++ b/crates/tests/misc/structs/Cargo.toml @@ -11,7 +11,6 @@ doctest = false [dependencies.windows] workspace = true features = [ - "implement", "Storage_Search", "Win32_Devices_Properties", "Win32_System_Diagnostics_Debug", diff --git a/crates/tests/winrt/collections/Cargo.toml b/crates/tests/winrt/collections/Cargo.toml index c2c34241ea..d998d49b60 100644 --- a/crates/tests/winrt/collections/Cargo.toml +++ b/crates/tests/winrt/collections/Cargo.toml @@ -11,7 +11,6 @@ doctest = false [dependencies.windows] workspace = true features = [ - "implement", "Foundation_Collections", "Globalization", "Win32_Foundation", diff --git a/crates/tests/winrt/composable/Cargo.toml b/crates/tests/winrt/composable/Cargo.toml index 723baeed14..d579afd24f 100644 --- a/crates/tests/winrt/composable/Cargo.toml +++ b/crates/tests/winrt/composable/Cargo.toml @@ -18,7 +18,6 @@ workspace = true [dependencies.windows] workspace = true features = [ - "implement", "Foundation", "Win32_System_WinRT", ] diff --git a/crates/tests/winrt/composable/src/bindings.rs b/crates/tests/winrt/composable/src/bindings.rs index cddebe9d49..ae80a4683a 100644 --- a/crates/tests/winrt/composable/src/bindings.rs +++ b/crates/tests/winrt/composable/src/bindings.rs @@ -28,6 +28,61 @@ pub struct ICompositor_Vtbl { *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, } +pub trait ICompositor_Impl: Sized + windows_core::IUnknownImpl { + fn CreateSpriteVisual(&self, brush: i32) -> windows_core::Result; + fn CreateContainerVisual(&self, children: i32) -> windows_core::Result; +} +impl windows_core::RuntimeName for ICompositor { + const NAME: &'static str = "test_composable.ICompositor"; +} +impl ICompositor_Vtbl { + pub const fn new() -> ICompositor_Vtbl { + unsafe extern "system" fn CreateSpriteVisual< + Identity: ICompositor_Impl, + const OFFSET: isize, + >( + this: *mut core::ffi::c_void, + brush: i32, + result__: *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match ICompositor_Impl::CreateSpriteVisual(this, brush) { + 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 CreateContainerVisual< + Identity: ICompositor_Impl, + const OFFSET: isize, + >( + this: *mut core::ffi::c_void, + children: i32, + result__: *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match ICompositor_Impl::CreateContainerVisual(this, children) { + 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::(), + CreateSpriteVisual: CreateSpriteVisual::, + CreateContainerVisual: CreateContainerVisual::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} windows_core::imp::define_interface!( IContainerVisual, IContainerVisual_Vtbl, @@ -43,6 +98,33 @@ pub struct IContainerVisual_Vtbl { pub Children: unsafe extern "system" fn(*mut core::ffi::c_void, *mut i32) -> windows_core::HRESULT, } +pub trait IContainerVisual_Impl: Sized + windows_core::IUnknownImpl { + fn Children(&self) -> i32; +} +impl windows_core::RuntimeName for IContainerVisual { + const NAME: &'static str = "test_composable.IContainerVisual"; +} +impl IContainerVisual_Vtbl { + pub const fn new() -> IContainerVisual_Vtbl + { + unsafe extern "system" fn Children( + this: *mut core::ffi::c_void, + result__: *mut i32, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + let ok__ = IContainerVisual_Impl::Children(this); + result__.write(core::mem::transmute_copy(&ok__)); + windows_core::HRESULT(0) + } + Self { + base__: windows_core::IInspectable_Vtbl::new::(), + Children: Children::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} windows_core::imp::define_interface!( IContainerVisualFactory, IContainerVisualFactory_Vtbl, @@ -56,6 +138,22 @@ impl windows_core::RuntimeType for IContainerVisualFactory { pub struct IContainerVisualFactory_Vtbl { pub base__: windows_core::IInspectable_Vtbl, } +pub trait IContainerVisualFactory_Impl: Sized + windows_core::IUnknownImpl {} +impl windows_core::RuntimeName for IContainerVisualFactory { + const NAME: &'static str = "test_composable.IContainerVisualFactory"; +} +impl IContainerVisualFactory_Vtbl { + pub const fn new( + ) -> IContainerVisualFactory_Vtbl { + Self { + base__: windows_core::IInspectable_Vtbl::new::( + ), + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} windows_core::imp::define_interface!( ISpriteVisual, ISpriteVisual_Vtbl, @@ -70,6 +168,32 @@ pub struct ISpriteVisual_Vtbl { pub base__: windows_core::IInspectable_Vtbl, pub Brush: unsafe extern "system" fn(*mut core::ffi::c_void, *mut i32) -> windows_core::HRESULT, } +pub trait ISpriteVisual_Impl: Sized + windows_core::IUnknownImpl { + fn Brush(&self) -> i32; +} +impl windows_core::RuntimeName for ISpriteVisual { + const NAME: &'static str = "test_composable.ISpriteVisual"; +} +impl ISpriteVisual_Vtbl { + pub const fn new() -> ISpriteVisual_Vtbl { + unsafe extern "system" fn Brush( + this: *mut core::ffi::c_void, + result__: *mut i32, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + let ok__ = ISpriteVisual_Impl::Brush(this); + result__.write(core::mem::transmute_copy(&ok__)); + windows_core::HRESULT(0) + } + Self { + base__: windows_core::IInspectable_Vtbl::new::(), + Brush: Brush::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} windows_core::imp::define_interface!( IVisual, IVisual_Vtbl, @@ -87,6 +211,37 @@ pub struct IVisual_Vtbl { *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, } +pub trait IVisual_Impl: Sized + windows_core::IUnknownImpl { + fn Compositor(&self) -> windows_core::Result; +} +impl windows_core::RuntimeName for IVisual { + const NAME: &'static str = "test_composable.IVisual"; +} +impl IVisual_Vtbl { + pub const fn new() -> IVisual_Vtbl { + unsafe extern "system" fn Compositor( + this: *mut core::ffi::c_void, + result__: *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IVisual_Impl::Compositor(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::(), + Compositor: Compositor::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} windows_core::imp::define_interface!( IVisualFactory, IVisualFactory_Vtbl, @@ -100,6 +255,20 @@ impl windows_core::RuntimeType for IVisualFactory { pub struct IVisualFactory_Vtbl { pub base__: windows_core::IInspectable_Vtbl, } +pub trait IVisualFactory_Impl: Sized + windows_core::IUnknownImpl {} +impl windows_core::RuntimeName for IVisualFactory { + const NAME: &'static str = "test_composable.IVisualFactory"; +} +impl IVisualFactory_Vtbl { + pub const fn new() -> IVisualFactory_Vtbl { + Self { + base__: windows_core::IInspectable_Vtbl::new::(), + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} #[repr(transparent)] #[derive(PartialEq, Eq, Debug, Clone)] pub struct Compositor(windows_core::IUnknown); @@ -298,172 +467,3 @@ impl windows_core::RuntimeName for Visual { } unsafe impl Send for Visual {} unsafe impl Sync for Visual {} -pub trait ICompositor_Impl: Sized + windows_core::IUnknownImpl { - fn CreateSpriteVisual(&self, brush: i32) -> windows_core::Result; - fn CreateContainerVisual(&self, children: i32) -> windows_core::Result; -} -impl windows_core::RuntimeName for ICompositor { - const NAME: &'static str = "test_composable.ICompositor"; -} -impl ICompositor_Vtbl { - pub const fn new() -> ICompositor_Vtbl { - unsafe extern "system" fn CreateSpriteVisual< - Identity: ICompositor_Impl, - const OFFSET: isize, - >( - this: *mut core::ffi::c_void, - brush: i32, - result__: *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match ICompositor_Impl::CreateSpriteVisual(this, brush) { - 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 CreateContainerVisual< - Identity: ICompositor_Impl, - const OFFSET: isize, - >( - this: *mut core::ffi::c_void, - children: i32, - result__: *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match ICompositor_Impl::CreateContainerVisual(this, children) { - 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::(), - CreateSpriteVisual: CreateSpriteVisual::, - CreateContainerVisual: CreateContainerVisual::, - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} -pub trait IContainerVisual_Impl: Sized + windows_core::IUnknownImpl { - fn Children(&self) -> i32; -} -impl windows_core::RuntimeName for IContainerVisual { - const NAME: &'static str = "test_composable.IContainerVisual"; -} -impl IContainerVisual_Vtbl { - pub const fn new() -> IContainerVisual_Vtbl - { - unsafe extern "system" fn Children( - this: *mut core::ffi::c_void, - result__: *mut i32, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - let ok__ = IContainerVisual_Impl::Children(this); - result__.write(core::mem::transmute_copy(&ok__)); - windows_core::HRESULT(0) - } - Self { - base__: windows_core::IInspectable_Vtbl::new::(), - Children: Children::, - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} -pub trait IContainerVisualFactory_Impl: Sized + windows_core::IUnknownImpl {} -impl windows_core::RuntimeName for IContainerVisualFactory { - const NAME: &'static str = "test_composable.IContainerVisualFactory"; -} -impl IContainerVisualFactory_Vtbl { - pub const fn new( - ) -> IContainerVisualFactory_Vtbl { - Self { - base__: windows_core::IInspectable_Vtbl::new::( - ), - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} -pub trait ISpriteVisual_Impl: Sized + windows_core::IUnknownImpl { - fn Brush(&self) -> i32; -} -impl windows_core::RuntimeName for ISpriteVisual { - const NAME: &'static str = "test_composable.ISpriteVisual"; -} -impl ISpriteVisual_Vtbl { - pub const fn new() -> ISpriteVisual_Vtbl { - unsafe extern "system" fn Brush( - this: *mut core::ffi::c_void, - result__: *mut i32, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - let ok__ = ISpriteVisual_Impl::Brush(this); - result__.write(core::mem::transmute_copy(&ok__)); - windows_core::HRESULT(0) - } - Self { - base__: windows_core::IInspectable_Vtbl::new::(), - Brush: Brush::, - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} -pub trait IVisual_Impl: Sized + windows_core::IUnknownImpl { - fn Compositor(&self) -> windows_core::Result; -} -impl windows_core::RuntimeName for IVisual { - const NAME: &'static str = "test_composable.IVisual"; -} -impl IVisual_Vtbl { - pub const fn new() -> IVisual_Vtbl { - unsafe extern "system" fn Compositor( - this: *mut core::ffi::c_void, - result__: *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IVisual_Impl::Compositor(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::(), - Compositor: Compositor::, - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} -pub trait IVisualFactory_Impl: Sized + windows_core::IUnknownImpl {} -impl windows_core::RuntimeName for IVisualFactory { - const NAME: &'static str = "test_composable.IVisualFactory"; -} -impl IVisualFactory_Vtbl { - pub const fn new() -> IVisualFactory_Vtbl { - Self { - base__: windows_core::IInspectable_Vtbl::new::(), - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} diff --git a/crates/tests/winrt/composable_client/Cargo.toml b/crates/tests/winrt/composable_client/Cargo.toml index 9bd6f6041d..167afb0b19 100644 --- a/crates/tests/winrt/composable_client/Cargo.toml +++ b/crates/tests/winrt/composable_client/Cargo.toml @@ -17,7 +17,6 @@ workspace = true [dependencies.windows] workspace = true features = [ - "implement", "Foundation", "Win32_Foundation", ] diff --git a/crates/tests/winrt/constructors/Cargo.toml b/crates/tests/winrt/constructors/Cargo.toml index 03062df0fb..11160b43c1 100644 --- a/crates/tests/winrt/constructors/Cargo.toml +++ b/crates/tests/winrt/constructors/Cargo.toml @@ -18,7 +18,6 @@ workspace = true [dependencies.windows] workspace = true features = [ - "implement", "Foundation", "Win32_System_WinRT", ] diff --git a/crates/tests/winrt/constructors/src/bindings.rs b/crates/tests/winrt/constructors/src/bindings.rs index 70ef1e463d..5b5e069819 100644 --- a/crates/tests/winrt/constructors/src/bindings.rs +++ b/crates/tests/winrt/constructors/src/bindings.rs @@ -20,6 +20,36 @@ pub struct IActivatable_Vtbl { pub Property: unsafe extern "system" fn(*mut core::ffi::c_void, *mut i32) -> windows_core::HRESULT, } +pub trait IActivatable_Impl: Sized + windows_core::IUnknownImpl { + fn Property(&self) -> windows_core::Result; +} +impl windows_core::RuntimeName for IActivatable { + const NAME: &'static str = "test_constructors.IActivatable"; +} +impl IActivatable_Vtbl { + pub const fn new() -> IActivatable_Vtbl { + unsafe extern "system" fn Property( + this: *mut core::ffi::c_void, + result__: *mut i32, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IActivatable_Impl::Property(this) { + Ok(ok__) => { + result__.write(core::mem::transmute_copy(&ok__)); + windows_core::HRESULT(0) + } + Err(err) => err.into(), + } + } + Self { + base__: windows_core::IInspectable_Vtbl::new::(), + Property: Property::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} windows_core::imp::define_interface!( IActivatableFactory, IActivatableFactory_Vtbl, @@ -38,6 +68,42 @@ pub struct IActivatableFactory_Vtbl { *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, } +pub trait IActivatableFactory_Impl: Sized + windows_core::IUnknownImpl { + fn WithValue(&self, arg: i32) -> windows_core::Result; +} +impl windows_core::RuntimeName for IActivatableFactory { + const NAME: &'static str = "test_constructors.IActivatableFactory"; +} +impl IActivatableFactory_Vtbl { + pub const fn new( + ) -> IActivatableFactory_Vtbl { + unsafe extern "system" fn WithValue< + Identity: IActivatableFactory_Impl, + const OFFSET: isize, + >( + this: *mut core::ffi::c_void, + arg: i32, + result__: *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IActivatableFactory_Impl::WithValue(this, arg) { + 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::(), + WithValue: WithValue::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} windows_core::imp::define_interface!( IComposable, IComposable_Vtbl, @@ -53,6 +119,36 @@ pub struct IComposable_Vtbl { pub Property: unsafe extern "system" fn(*mut core::ffi::c_void, *mut i32) -> windows_core::HRESULT, } +pub trait IComposable_Impl: Sized + windows_core::IUnknownImpl { + fn Property(&self) -> windows_core::Result; +} +impl windows_core::RuntimeName for IComposable { + const NAME: &'static str = "test_constructors.IComposable"; +} +impl IComposable_Vtbl { + pub const fn new() -> IComposable_Vtbl { + unsafe extern "system" fn Property( + this: *mut core::ffi::c_void, + result__: *mut i32, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IComposable_Impl::Property(this) { + Ok(ok__) => { + result__.write(core::mem::transmute_copy(&ok__)); + windows_core::HRESULT(0) + } + Err(err) => err.into(), + } + } + Self { + base__: windows_core::IInspectable_Vtbl::new::(), + Property: Property::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} windows_core::imp::define_interface!( IComposableFactory, IComposableFactory_Vtbl, @@ -79,6 +175,83 @@ pub struct IComposableFactory_Vtbl { *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, } +pub trait IComposableFactory_Impl: Sized + windows_core::IUnknownImpl { + fn CreateInstance( + &self, + baseinterface: Option<&windows_core::IInspectable>, + innerinterface: &mut Option, + ) -> windows_core::Result; + fn WithValue( + &self, + arg: i32, + baseinterface: Option<&windows_core::IInspectable>, + innerinterface: &mut Option, + ) -> windows_core::Result; +} +impl windows_core::RuntimeName for IComposableFactory { + const NAME: &'static str = "test_constructors.IComposableFactory"; +} +impl IComposableFactory_Vtbl { + pub const fn new( + ) -> IComposableFactory_Vtbl { + unsafe extern "system" fn CreateInstance< + Identity: IComposableFactory_Impl, + const OFFSET: isize, + >( + this: *mut core::ffi::c_void, + baseinterface: *mut core::ffi::c_void, + innerinterface: *mut *mut core::ffi::c_void, + result__: *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IComposableFactory_Impl::CreateInstance( + this, + windows_core::from_raw_borrowed(&baseinterface), + core::mem::transmute_copy(&innerinterface), + ) { + 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 WithValue< + Identity: IComposableFactory_Impl, + const OFFSET: isize, + >( + this: *mut core::ffi::c_void, + arg: i32, + baseinterface: *mut core::ffi::c_void, + innerinterface: *mut *mut core::ffi::c_void, + result__: *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IComposableFactory_Impl::WithValue( + this, + arg, + windows_core::from_raw_borrowed(&baseinterface), + core::mem::transmute_copy(&innerinterface), + ) { + 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::(), + CreateInstance: CreateInstance::, + WithValue: WithValue::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} #[repr(transparent)] #[derive(PartialEq, Eq, Debug, Clone)] pub struct Activatable(windows_core::IUnknown); @@ -212,176 +385,3 @@ impl windows_core::RuntimeName for Composable { } unsafe impl Send for Composable {} unsafe impl Sync for Composable {} -pub trait IActivatable_Impl: Sized + windows_core::IUnknownImpl { - fn Property(&self) -> windows_core::Result; -} -impl windows_core::RuntimeName for IActivatable { - const NAME: &'static str = "test_constructors.IActivatable"; -} -impl IActivatable_Vtbl { - pub const fn new() -> IActivatable_Vtbl { - unsafe extern "system" fn Property( - this: *mut core::ffi::c_void, - result__: *mut i32, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IActivatable_Impl::Property(this) { - Ok(ok__) => { - result__.write(core::mem::transmute_copy(&ok__)); - windows_core::HRESULT(0) - } - Err(err) => err.into(), - } - } - Self { - base__: windows_core::IInspectable_Vtbl::new::(), - Property: Property::, - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} -pub trait IActivatableFactory_Impl: Sized + windows_core::IUnknownImpl { - fn WithValue(&self, arg: i32) -> windows_core::Result; -} -impl windows_core::RuntimeName for IActivatableFactory { - const NAME: &'static str = "test_constructors.IActivatableFactory"; -} -impl IActivatableFactory_Vtbl { - pub const fn new( - ) -> IActivatableFactory_Vtbl { - unsafe extern "system" fn WithValue< - Identity: IActivatableFactory_Impl, - const OFFSET: isize, - >( - this: *mut core::ffi::c_void, - arg: i32, - result__: *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IActivatableFactory_Impl::WithValue(this, arg) { - 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::(), - WithValue: WithValue::, - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} -pub trait IComposable_Impl: Sized + windows_core::IUnknownImpl { - fn Property(&self) -> windows_core::Result; -} -impl windows_core::RuntimeName for IComposable { - const NAME: &'static str = "test_constructors.IComposable"; -} -impl IComposable_Vtbl { - pub const fn new() -> IComposable_Vtbl { - unsafe extern "system" fn Property( - this: *mut core::ffi::c_void, - result__: *mut i32, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IComposable_Impl::Property(this) { - Ok(ok__) => { - result__.write(core::mem::transmute_copy(&ok__)); - windows_core::HRESULT(0) - } - Err(err) => err.into(), - } - } - Self { - base__: windows_core::IInspectable_Vtbl::new::(), - Property: Property::, - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} -pub trait IComposableFactory_Impl: Sized + windows_core::IUnknownImpl { - fn CreateInstance( - &self, - baseinterface: Option<&windows_core::IInspectable>, - innerinterface: &mut Option, - ) -> windows_core::Result; - fn WithValue( - &self, - arg: i32, - baseinterface: Option<&windows_core::IInspectable>, - innerinterface: &mut Option, - ) -> windows_core::Result; -} -impl windows_core::RuntimeName for IComposableFactory { - const NAME: &'static str = "test_constructors.IComposableFactory"; -} -impl IComposableFactory_Vtbl { - pub const fn new( - ) -> IComposableFactory_Vtbl { - unsafe extern "system" fn CreateInstance< - Identity: IComposableFactory_Impl, - const OFFSET: isize, - >( - this: *mut core::ffi::c_void, - baseinterface: *mut core::ffi::c_void, - innerinterface: *mut *mut core::ffi::c_void, - result__: *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IComposableFactory_Impl::CreateInstance( - this, - windows_core::from_raw_borrowed(&baseinterface), - core::mem::transmute_copy(&innerinterface), - ) { - 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 WithValue< - Identity: IComposableFactory_Impl, - const OFFSET: isize, - >( - this: *mut core::ffi::c_void, - arg: i32, - baseinterface: *mut core::ffi::c_void, - innerinterface: *mut *mut core::ffi::c_void, - result__: *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IComposableFactory_Impl::WithValue( - this, - arg, - windows_core::from_raw_borrowed(&baseinterface), - core::mem::transmute_copy(&innerinterface), - ) { - 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::(), - CreateInstance: CreateInstance::, - WithValue: WithValue::, - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} diff --git a/crates/tests/winrt/constructors_client/Cargo.toml b/crates/tests/winrt/constructors_client/Cargo.toml index 91387cea02..fc044f922d 100644 --- a/crates/tests/winrt/constructors_client/Cargo.toml +++ b/crates/tests/winrt/constructors_client/Cargo.toml @@ -17,7 +17,6 @@ workspace = true [dependencies.windows] workspace = true features = [ - "implement", "Foundation", "Win32_Foundation", ] diff --git a/crates/tests/winrt/old/Cargo.toml b/crates/tests/winrt/old/Cargo.toml index 68955e26a6..57cb3e8c79 100644 --- a/crates/tests/winrt/old/Cargo.toml +++ b/crates/tests/winrt/old/Cargo.toml @@ -11,7 +11,6 @@ doctest = false [dependencies.windows] workspace = true features = [ - "implement", "AI_MachineLearning", "ApplicationModel_Activation", "ApplicationModel_Appointments", diff --git a/crates/tests/winrt/reference_float/Cargo.toml b/crates/tests/winrt/reference_float/Cargo.toml index 3f8d568b27..75e84243ec 100644 --- a/crates/tests/winrt/reference_float/Cargo.toml +++ b/crates/tests/winrt/reference_float/Cargo.toml @@ -18,6 +18,5 @@ workspace = true [dependencies.windows] workspace = true features = [ - "implement", "Foundation", ]