diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 2095a6fd4a..57988144fd 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -160,8 +160,6 @@ jobs: run: cargo clippy -p test_core - name: Clippy test_debug run: cargo clippy -p test_debug - - name: Clippy test_debug_inspectable - run: cargo clippy -p test_debug_inspectable - name: Clippy test_debugger_visualizer run: cargo clippy -p test_debugger_visualizer - name: Clippy test_deprecated diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e6944e4e45..84c509d81a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -186,8 +186,6 @@ jobs: run: cargo test -p test_core --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_debug run: cargo test -p test_debug --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Test test_debug_inspectable - run: cargo test -p test_debug_inspectable --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_debugger_visualizer run: cargo test -p test_debugger_visualizer --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_deprecated @@ -258,10 +256,10 @@ jobs: run: cargo test -p test_riddle --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_standalone run: cargo test -p test_standalone --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Clean - run: cargo clean - name: Test test_string_param run: cargo test -p test_string_param --target ${{ matrix.target }} ${{ matrix.etc }} + - name: Clean + run: cargo clean - name: Test test_strings run: cargo test -p test_strings --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_structs diff --git a/crates/libs/core/src/imp/com_bindings.rs b/crates/libs/core/src/imp/com_bindings.rs index fc6419ada3..9683b3353b 100644 --- a/crates/libs/core/src/imp/com_bindings.rs +++ b/crates/libs/core/src/imp/com_bindings.rs @@ -40,23 +40,6 @@ impl core::fmt::Debug for AgileReferenceOptions { } } pub const CO_E_NOTINITIALIZED: windows_core::HRESULT = windows_core::HRESULT(0x800401F0_u32 as _); -#[repr(C)] -#[derive(Clone, Copy, Debug, Eq, PartialEq)] -pub struct DateTime { - pub UniversalTime: i64, -} -impl windows_core::TypeKind for DateTime { - type TypeKind = windows_core::CopyType; -} -impl windows_core::RuntimeType for DateTime { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::from_slice(b"struct(Windows.Foundation.DateTime;i8)"); -} -impl Default for DateTime { - fn default() -> Self { - unsafe { core::mem::zeroed() } - } -} pub const E_BOUNDS: windows_core::HRESULT = windows_core::HRESULT(0x8000000B_u32 as _); pub const E_NOINTERFACE: windows_core::HRESULT = windows_core::HRESULT(0x80004002_u32 as _); pub const E_OUTOFMEMORY: windows_core::HRESULT = windows_core::HRESULT(0x8007000E_u32 as _); @@ -113,1404 +96,6 @@ pub struct IAgileReference_Vtbl { *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, } -windows_core::imp::define_interface!( - IPropertyValue, - IPropertyValue_Vtbl, - 0x4bd682dd_7554_40e9_9a9b_82654ede7e62 -); -impl core::ops::Deref for IPropertyValue { - type Target = windows_core::IInspectable; - fn deref(&self) -> &Self::Target { - unsafe { core::mem::transmute(self) } - } -} -windows_core::imp::interface_hierarchy!( - IPropertyValue, - windows_core::IUnknown, - windows_core::IInspectable -); -impl IPropertyValue { - pub fn Type(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).Type)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn IsNumericScalar(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).IsNumericScalar)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetUInt8(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetUInt8)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetInt16(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetInt16)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetUInt16(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetUInt16)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetInt32(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetInt32)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetUInt32(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetUInt32)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetInt64(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetInt64)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetUInt64(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetUInt64)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetSingle(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetSingle)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetDouble(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetDouble)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetChar16(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetChar16)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetBoolean(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetBoolean)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetString(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetString)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - } - } - pub fn GetGuid(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetGuid)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetDateTime(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetDateTime)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetTimeSpan(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetTimeSpan)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetPoint(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetPoint)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetSize(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetSize)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetRect(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetRect)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetUInt8Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetUInt8Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetInt16Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetInt16Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetUInt16Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetUInt16Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetInt32Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetInt32Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetUInt32Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetUInt32Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetInt64Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetInt64Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetUInt64Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetUInt64Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetSingleArray(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetSingleArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetDoubleArray(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetDoubleArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetChar16Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetChar16Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetBooleanArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetBooleanArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetStringArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetStringArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetInspectableArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetInspectableArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetGuidArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetGuidArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetDateTimeArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetDateTimeArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetTimeSpanArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetTimeSpanArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetPointArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetPointArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetSizeArray(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetSizeArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetRectArray(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = self; - unsafe { - (windows_core::Interface::vtable(this).GetRectArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } -} -impl windows_core::RuntimeType for IPropertyValue { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::for_interface::(); -} -#[repr(C)] -pub struct IPropertyValue_Vtbl { - pub base__: windows_core::IInspectable_Vtbl, - pub Type: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut PropertyType, - ) -> windows_core::HRESULT, - pub IsNumericScalar: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut bool) -> windows_core::HRESULT, - pub GetUInt8: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut u8) -> windows_core::HRESULT, - pub GetInt16: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut i16) -> windows_core::HRESULT, - pub GetUInt16: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut u16) -> windows_core::HRESULT, - pub GetInt32: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut i32) -> windows_core::HRESULT, - pub GetUInt32: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT, - pub GetInt64: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut i64) -> windows_core::HRESULT, - pub GetUInt64: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut u64) -> windows_core::HRESULT, - pub GetSingle: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut f32) -> windows_core::HRESULT, - pub GetDouble: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut f64) -> windows_core::HRESULT, - pub GetChar16: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut u16) -> windows_core::HRESULT, - pub GetBoolean: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut bool) -> windows_core::HRESULT, - pub GetString: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut core::mem::MaybeUninit, - ) -> windows_core::HRESULT, - pub GetGuid: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut windows_core::GUID, - ) -> windows_core::HRESULT, - pub GetDateTime: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut DateTime) -> windows_core::HRESULT, - pub GetTimeSpan: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut TimeSpan) -> windows_core::HRESULT, - pub GetPoint: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut Point) -> windows_core::HRESULT, - pub GetSize: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut Size) -> windows_core::HRESULT, - pub GetRect: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut Rect) -> windows_core::HRESULT, - pub GetUInt8Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut u8, - ) -> windows_core::HRESULT, - pub GetInt16Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut i16, - ) -> windows_core::HRESULT, - pub GetUInt16Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut u16, - ) -> windows_core::HRESULT, - pub GetInt32Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut i32, - ) -> windows_core::HRESULT, - pub GetUInt32Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut u32, - ) -> windows_core::HRESULT, - pub GetInt64Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut i64, - ) -> windows_core::HRESULT, - pub GetUInt64Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut u64, - ) -> windows_core::HRESULT, - pub GetSingleArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut f32, - ) -> windows_core::HRESULT, - pub GetDoubleArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut f64, - ) -> windows_core::HRESULT, - pub GetChar16Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut u16, - ) -> windows_core::HRESULT, - pub GetBooleanArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut bool, - ) -> windows_core::HRESULT, - pub GetStringArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut core::mem::MaybeUninit, - ) -> windows_core::HRESULT, - pub GetInspectableArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub GetGuidArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut windows_core::GUID, - ) -> windows_core::HRESULT, - pub GetDateTimeArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut DateTime, - ) -> windows_core::HRESULT, - pub GetTimeSpanArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut TimeSpan, - ) -> windows_core::HRESULT, - pub GetPointArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut Point, - ) -> windows_core::HRESULT, - pub GetSizeArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut Size, - ) -> windows_core::HRESULT, - pub GetRectArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut u32, - *mut *mut Rect, - ) -> windows_core::HRESULT, -} -windows_core::imp::define_interface!( - IPropertyValueStatics, - IPropertyValueStatics_Vtbl, - 0x629bdbc8_d932_4ff4_96b9_8d96c5c1e858 -); -impl windows_core::RuntimeType for IPropertyValueStatics { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::for_interface::(); -} -#[repr(C)] -pub struct IPropertyValueStatics_Vtbl { - pub base__: windows_core::IInspectable_Vtbl, - pub CreateEmpty: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateUInt8: unsafe extern "system" fn( - *mut core::ffi::c_void, - u8, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateInt16: unsafe extern "system" fn( - *mut core::ffi::c_void, - i16, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateUInt16: unsafe extern "system" fn( - *mut core::ffi::c_void, - u16, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateInt32: unsafe extern "system" fn( - *mut core::ffi::c_void, - i32, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateUInt32: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateInt64: unsafe extern "system" fn( - *mut core::ffi::c_void, - i64, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateUInt64: unsafe extern "system" fn( - *mut core::ffi::c_void, - u64, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateSingle: unsafe extern "system" fn( - *mut core::ffi::c_void, - f32, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateDouble: unsafe extern "system" fn( - *mut core::ffi::c_void, - f64, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateChar16: unsafe extern "system" fn( - *mut core::ffi::c_void, - u16, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateBoolean: unsafe extern "system" fn( - *mut core::ffi::c_void, - bool, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateString: unsafe extern "system" fn( - *mut core::ffi::c_void, - core::mem::MaybeUninit, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateInspectable: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateGuid: unsafe extern "system" fn( - *mut core::ffi::c_void, - windows_core::GUID, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateDateTime: unsafe extern "system" fn( - *mut core::ffi::c_void, - DateTime, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateTimeSpan: unsafe extern "system" fn( - *mut core::ffi::c_void, - TimeSpan, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreatePoint: unsafe extern "system" fn( - *mut core::ffi::c_void, - Point, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateSize: unsafe extern "system" fn( - *mut core::ffi::c_void, - Size, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateRect: unsafe extern "system" fn( - *mut core::ffi::c_void, - Rect, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateUInt8Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const u8, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateInt16Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const i16, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateUInt16Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const u16, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateInt32Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const i32, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateUInt32Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const u32, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateInt64Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const i64, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateUInt64Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const u64, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateSingleArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const f32, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateDoubleArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const f64, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateChar16Array: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const u16, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateBooleanArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const bool, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateStringArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const core::mem::MaybeUninit, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateInspectableArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateGuidArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const windows_core::GUID, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateDateTimeArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const DateTime, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateTimeSpanArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const TimeSpan, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreatePointArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const Point, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateSizeArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const Size, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateRectArray: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const Rect, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, -} -#[repr(transparent)] -#[derive(PartialEq, Eq, Debug, Clone)] -pub struct IReference(windows_core::IUnknown, core::marker::PhantomData) -where - T: windows_core::RuntimeType + 'static; -impl core::ops::Deref for IReference { - type Target = windows_core::IInspectable; - fn deref(&self) -> &Self::Target { - unsafe { core::mem::transmute(self) } - } -} -impl windows_core::imp::CanInto - for IReference -{ -} -impl windows_core::imp::CanInto - for IReference -{ -} -impl windows_core::imp::CanInto - for IReference -{ - const QUERY: bool = true; -} -impl IReference { - pub fn Value(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).Value)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - } - } - pub fn Type(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).Type)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn IsNumericScalar(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).IsNumericScalar)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetUInt8(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetUInt8)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetInt16(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetInt16)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetUInt16(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetUInt16)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetInt32(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetInt32)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetUInt32(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetUInt32)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetInt64(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetInt64)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetUInt64(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetUInt64)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetSingle(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetSingle)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetDouble(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetDouble)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetChar16(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetChar16)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetBoolean(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetBoolean)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetString(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetString)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - } - } - pub fn GetGuid(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetGuid)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetDateTime(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetDateTime)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetTimeSpan(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetTimeSpan)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetPoint(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetPoint)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetSize(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetSize)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetRect(&self) -> windows_core::Result { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).GetRect)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| result__) - } - } - pub fn GetUInt8Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetUInt8Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetInt16Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetInt16Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetUInt16Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetUInt16Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetInt32Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetInt32Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetUInt32Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetUInt32Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetInt64Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetInt64Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetUInt64Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetUInt64Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetSingleArray(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetSingleArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetDoubleArray(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetDoubleArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetChar16Array(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetChar16Array)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetBooleanArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetBooleanArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetStringArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetStringArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetInspectableArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetInspectableArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetGuidArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetGuidArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetDateTimeArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetDateTimeArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetTimeSpanArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetTimeSpanArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetPointArray( - &self, - value: &mut windows_core::Array, - ) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetPointArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetSizeArray(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetSizeArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } - pub fn GetRectArray(&self, value: &mut windows_core::Array) -> windows_core::Result<()> { - let this = &windows_core::Interface::cast::(self)?; - unsafe { - (windows_core::Interface::vtable(this).GetRectArray)( - windows_core::Interface::as_raw(this), - value.set_abi_len(), - value as *mut _ as _, - ) - .ok() - } - } -} -impl windows_core::RuntimeType for IReference { - const SIGNATURE: windows_core::imp::ConstBuffer = { - windows_core::imp::ConstBuffer::new() - .push_slice(b"pinterface(") - .push_slice(b"{61c17706-2d65-11e0-9ae8-d48564015472}") - .push_slice(b";") - .push_other(T::SIGNATURE) - .push_slice(b")") - }; -} -unsafe impl windows_core::Interface for IReference { - type Vtable = IReference_Vtbl; - const IID: windows_core::GUID = - windows_core::GUID::from_signature(::SIGNATURE); -} -#[repr(C)] -pub struct IReference_Vtbl -where - T: windows_core::RuntimeType + 'static, -{ - pub base__: windows_core::IInspectable_Vtbl, - pub Value: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut windows_core::AbiType, - ) -> windows_core::HRESULT, - pub T: core::marker::PhantomData, -} -windows_core::imp::define_interface!( - IStringable, - IStringable_Vtbl, - 0x96369f54_8eb6_48f0_abce_c1b211e627c3 -); -impl core::ops::Deref for IStringable { - type Target = windows_core::IInspectable; - fn deref(&self) -> &Self::Target { - unsafe { core::mem::transmute(self) } - } -} -windows_core::imp::interface_hierarchy!( - IStringable, - windows_core::IUnknown, - windows_core::IInspectable -); -impl IStringable { - pub fn ToString(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).ToString)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - } - } -} -impl windows_core::RuntimeType for IStringable { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::for_interface::(); -} -#[repr(C)] -pub struct IStringable_Vtbl { - pub base__: windows_core::IInspectable_Vtbl, - pub ToString: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut core::mem::MaybeUninit, - ) -> windows_core::HRESULT, -} windows_core::imp::define_interface!( IWeakReference, IWeakReference_Vtbl, @@ -1577,617 +162,5 @@ pub struct IWeakReferenceSource_Vtbl { ) -> windows_core::HRESULT, } pub const JSCRIPT_E_CANTEXECUTE: windows_core::HRESULT = windows_core::HRESULT(0x89020001_u32 as _); -#[repr(C)] -#[derive(Clone, Copy, Debug, PartialEq)] -pub struct Point { - pub X: f32, - pub Y: f32, -} -impl windows_core::TypeKind for Point { - type TypeKind = windows_core::CopyType; -} -impl windows_core::RuntimeType for Point { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::from_slice(b"struct(Windows.Foundation.Point;f4;f4)"); -} -impl Default for Point { - fn default() -> Self { - unsafe { core::mem::zeroed() } - } -} -#[repr(transparent)] -#[derive(PartialEq, Eq, Copy, Clone, Default)] -pub struct PropertyType(pub i32); -impl PropertyType { - pub const Empty: Self = Self(0i32); - pub const UInt8: Self = Self(1i32); - pub const Int16: Self = Self(2i32); - pub const UInt16: Self = Self(3i32); - pub const Int32: Self = Self(4i32); - pub const UInt32: Self = Self(5i32); - pub const Int64: Self = Self(6i32); - pub const UInt64: Self = Self(7i32); - pub const Single: Self = Self(8i32); - pub const Double: Self = Self(9i32); - pub const Char16: Self = Self(10i32); - pub const Boolean: Self = Self(11i32); - pub const String: Self = Self(12i32); - pub const Inspectable: Self = Self(13i32); - pub const DateTime: Self = Self(14i32); - pub const TimeSpan: Self = Self(15i32); - pub const Guid: Self = Self(16i32); - pub const Point: Self = Self(17i32); - pub const Size: Self = Self(18i32); - pub const Rect: Self = Self(19i32); - pub const OtherType: Self = Self(20i32); - pub const UInt8Array: Self = Self(1025i32); - pub const Int16Array: Self = Self(1026i32); - pub const UInt16Array: Self = Self(1027i32); - pub const Int32Array: Self = Self(1028i32); - pub const UInt32Array: Self = Self(1029i32); - pub const Int64Array: Self = Self(1030i32); - pub const UInt64Array: Self = Self(1031i32); - pub const SingleArray: Self = Self(1032i32); - pub const DoubleArray: Self = Self(1033i32); - pub const Char16Array: Self = Self(1034i32); - pub const BooleanArray: Self = Self(1035i32); - pub const StringArray: Self = Self(1036i32); - pub const InspectableArray: Self = Self(1037i32); - pub const DateTimeArray: Self = Self(1038i32); - pub const TimeSpanArray: Self = Self(1039i32); - pub const GuidArray: Self = Self(1040i32); - pub const PointArray: Self = Self(1041i32); - pub const SizeArray: Self = Self(1042i32); - pub const RectArray: Self = Self(1043i32); - pub const OtherTypeArray: Self = Self(1044i32); -} -impl windows_core::TypeKind for PropertyType { - type TypeKind = windows_core::CopyType; -} -impl core::fmt::Debug for PropertyType { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.debug_tuple("PropertyType").field(&self.0).finish() - } -} -impl windows_core::RuntimeType for PropertyType { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::from_slice(b"enum(Windows.Foundation.PropertyType;i4)"); -} -pub struct PropertyValue; -impl PropertyValue { - pub fn CreateEmpty() -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateEmpty)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateUInt8(value: u8) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateUInt8)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateInt16(value: i16) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateInt16)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateUInt16(value: u16) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateUInt16)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateInt32(value: i32) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateInt32)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateUInt32(value: u32) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateUInt32)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateInt64(value: i64) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateInt64)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateUInt64(value: u64) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateUInt64)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateSingle(value: f32) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateSingle)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateDouble(value: f64) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateDouble)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateChar16(value: u16) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateChar16)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateBoolean(value: bool) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateBoolean)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateString( - value: &windows_core::HSTRING, - ) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateString)( - windows_core::Interface::as_raw(this), - core::mem::transmute_copy(value), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateInspectable(value: P0) -> windows_core::Result - where - P0: windows_core::Param, - { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateInspectable)( - windows_core::Interface::as_raw(this), - value.param().abi(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateGuid( - value: windows_core::GUID, - ) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateGuid)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateDateTime(value: DateTime) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateDateTime)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateTimeSpan(value: TimeSpan) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateTimeSpan)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreatePoint(value: Point) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreatePoint)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateSize(value: Size) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateSize)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateRect(value: Rect) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateRect)( - windows_core::Interface::as_raw(this), - value, - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateUInt8Array(value: &[u8]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateUInt8Array)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateInt16Array(value: &[i16]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateInt16Array)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateUInt16Array(value: &[u16]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateUInt16Array)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateInt32Array(value: &[i32]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateInt32Array)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateUInt32Array(value: &[u32]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateUInt32Array)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateInt64Array(value: &[i64]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateInt64Array)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateUInt64Array(value: &[u64]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateUInt64Array)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateSingleArray(value: &[f32]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateSingleArray)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateDoubleArray(value: &[f64]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateDoubleArray)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateChar16Array(value: &[u16]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateChar16Array)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateBooleanArray(value: &[bool]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateBooleanArray)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateStringArray( - value: &[windows_core::HSTRING], - ) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateStringArray)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - core::mem::transmute(value.as_ptr()), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateInspectableArray( - value: &[Option], - ) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateInspectableArray)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - core::mem::transmute(value.as_ptr()), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateGuidArray( - value: &[windows_core::GUID], - ) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateGuidArray)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateDateTimeArray( - value: &[DateTime], - ) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateDateTimeArray)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateTimeSpanArray( - value: &[TimeSpan], - ) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateTimeSpanArray)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreatePointArray(value: &[Point]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreatePointArray)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateSizeArray(value: &[Size]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateSizeArray)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - pub fn CreateRectArray(value: &[Rect]) -> windows_core::Result { - Self::IPropertyValueStatics(|this| unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).CreateRectArray)( - windows_core::Interface::as_raw(this), - value.len().try_into().unwrap(), - value.as_ptr(), - &mut result__, - ) - .and_then(|| windows_core::Type::from_abi(result__)) - }) - } - #[doc(hidden)] - pub fn IPropertyValueStatics< - R, - F: FnOnce(&IPropertyValueStatics) -> windows_core::Result, - >( - callback: F, - ) -> windows_core::Result { - static SHARED: windows_core::imp::FactoryCache = - windows_core::imp::FactoryCache::new(); - SHARED.call(callback) - } -} -impl windows_core::RuntimeName for PropertyValue { - const NAME: &'static str = "Windows.Foundation.PropertyValue"; -} pub const RPC_E_DISCONNECTED: windows_core::HRESULT = windows_core::HRESULT(0x80010108_u32 as _); -#[repr(C)] -#[derive(Clone, Copy, Debug, PartialEq)] -pub struct Rect { - pub X: f32, - pub Y: f32, - pub Width: f32, - pub Height: f32, -} -impl windows_core::TypeKind for Rect { - type TypeKind = windows_core::CopyType; -} -impl windows_core::RuntimeType for Rect { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::from_slice(b"struct(Windows.Foundation.Rect;f4;f4;f4;f4)"); -} -impl Default for Rect { - fn default() -> Self { - unsafe { core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Clone, Copy, Debug, PartialEq)] -pub struct Size { - pub Width: f32, - pub Height: f32, -} -impl windows_core::TypeKind for Size { - type TypeKind = windows_core::CopyType; -} -impl windows_core::RuntimeType for Size { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::from_slice(b"struct(Windows.Foundation.Size;f4;f4)"); -} -impl Default for Size { - fn default() -> Self { - unsafe { core::mem::zeroed() } - } -} pub const TYPE_E_TYPEMISMATCH: windows_core::HRESULT = windows_core::HRESULT(0x80028CA0_u32 as _); -#[repr(C)] -#[derive(Clone, Copy, Debug, Eq, PartialEq)] -pub struct TimeSpan { - pub Duration: i64, -} -impl windows_core::TypeKind for TimeSpan { - type TypeKind = windows_core::CopyType; -} -impl windows_core::RuntimeType for TimeSpan { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::from_slice(b"struct(Windows.Foundation.TimeSpan;i8)"); -} -impl Default for TimeSpan { - fn default() -> Self { - unsafe { core::mem::zeroed() } - } -} diff --git a/crates/libs/core/src/inspectable.rs b/crates/libs/core/src/inspectable.rs index de6b676610..9e1904cfdd 100644 --- a/crates/libs/core/src/inspectable.rs +++ b/crates/libs/core/src/inspectable.rs @@ -8,7 +8,7 @@ use core::ptr::null_mut; /// [IInspectable](https://docs.microsoft.com/en-us/windows/win32/api/inspectable/nn-inspectable-iinspectable) /// interface. #[repr(transparent)] -#[derive(Clone, PartialEq, Eq)] +#[derive(Clone, PartialEq, Eq, Debug)] pub struct IInspectable(pub IUnknown); interface_hierarchy!(IInspectable, IUnknown); @@ -104,82 +104,3 @@ impl IInspectable_Vtbl { } } } - -impl core::fmt::Debug for IInspectable { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - // Attempts to retrieve the string representation of the object via the - // IStringable interface. If that fails, it will use the canonical type - // name to give some idea of what the object represents. - let name = ::cast::(self) - .and_then(|s| s.ToString()) - .or_else(|_| self.GetRuntimeClassName()) - .unwrap_or_default(); - write!(f, "\"{}\"", name) - } -} - -macro_rules! primitive_boxed_type { - ($(($t:ty, $m:ident)),+) => { - $(impl TryFrom<$t> for IInspectable { - type Error = Error; - fn try_from(value: $t) -> Result { - imp::PropertyValue::$m(value) - } - } - impl TryFrom for $t { - type Error = Error; - fn try_from(value: IInspectable) -> Result { - ::cast::>(&value)?.Value() - } - } - impl TryFrom<&IInspectable> for $t { - type Error = Error; - fn try_from(value: &IInspectable) -> Result { - ::cast::>(value)?.Value() - } - })* - }; -} -primitive_boxed_type! { - (bool, CreateBoolean), - (u8, CreateUInt8), - (i16, CreateInt16), - (u16, CreateUInt16), - (i32, CreateInt32), - (u32, CreateUInt32), - (i64, CreateInt64), - (u64, CreateUInt64), - (f32, CreateSingle), - (f64, CreateDouble) -} -impl TryFrom<&str> for IInspectable { - type Error = Error; - fn try_from(value: &str) -> Result { - let value: HSTRING = value.into(); - imp::PropertyValue::CreateString(&value) - } -} -impl TryFrom for IInspectable { - type Error = Error; - fn try_from(value: HSTRING) -> Result { - imp::PropertyValue::CreateString(&value) - } -} -impl TryFrom<&HSTRING> for IInspectable { - type Error = Error; - fn try_from(value: &HSTRING) -> Result { - imp::PropertyValue::CreateString(value) - } -} -impl TryFrom for HSTRING { - type Error = Error; - fn try_from(value: IInspectable) -> Result { - ::cast::>(&value)?.Value() - } -} -impl TryFrom<&IInspectable> for HSTRING { - type Error = Error; - fn try_from(value: &IInspectable) -> Result { - ::cast::>(value)?.Value() - } -} diff --git a/crates/tests/debug_inspectable/Cargo.toml b/crates/tests/debug_inspectable/Cargo.toml deleted file mode 100644 index 5eefdf6bfc..0000000000 --- a/crates/tests/debug_inspectable/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "test_debug_inspectable" -version = "0.0.0" -edition = "2021" -publish = false - -[lib] -doc = false -doctest = false - -[dependencies.windows] -path = "../../libs/windows" -features = [ - "Foundation_Collections", -] diff --git a/crates/tests/debug_inspectable/src/lib.rs b/crates/tests/debug_inspectable/src/lib.rs deleted file mode 100644 index 8b13789179..0000000000 --- a/crates/tests/debug_inspectable/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/crates/tests/debug_inspectable/tests/tests.rs b/crates/tests/debug_inspectable/tests/tests.rs deleted file mode 100644 index b61a5d1cfe..0000000000 --- a/crates/tests/debug_inspectable/tests/tests.rs +++ /dev/null @@ -1,15 +0,0 @@ -use windows::{core::*, Foundation::Collections::*, Foundation::*}; - -#[test] -fn test() -> Result<()> { - let stringable: IInspectable = Uri::CreateUri(h!("https://kennykerr.ca"))?.cast()?; - let non_stringable: IInspectable = PropertySet::new()?.cast()?; - - assert_eq!(format!("{:?}", stringable), "\"https://kennykerr.ca/\""); - assert_eq!( - format!("{:?}", non_stringable), - "\"Windows.Foundation.Collections.PropertySet\"" - ); - - Ok(()) -} diff --git a/crates/tests/winrt/tests/boxing.rs b/crates/tests/winrt/tests/boxing.rs deleted file mode 100644 index 25bf72de89..0000000000 --- a/crates/tests/winrt/tests/boxing.rs +++ /dev/null @@ -1,121 +0,0 @@ -use windows::core::*; -use windows::Foundation::*; - -macro_rules! primitive_try_into_test { - ($(($t:ty, $v:literal)),+) => { - $( - let o: IInspectable = $v.try_into()?; - let t: $t = (&o).try_into()?; - assert_eq!($v, t); - let t: $t = o.try_into()?; - assert_eq!($v, t); - )* - }; -} - -macro_rules! primitive_try_from_test { - ($(($t:ty, $v:literal)),+) => { - $( - let o = IInspectable::try_from($v)?; - assert_eq!($v, <$t>::try_from(&o)?); - assert_eq!($v, <$t>::try_from(o)?); - )* - }; -} - -#[test] -fn boxing_into() -> Result<()> { - primitive_try_into_test! { - (bool, true), - (bool, false), - (u8, 123_u8), - (i16, 123_i16), - (u16, 123_u16), - (i32, 123_i32), - (u32, 123_u32), - (i64, 123_i64), - (u64, 123_u64), - (f32, 123_f32), - (f64, 123_f64) - } - - primitive_try_from_test! { - (bool, true), - (bool, false), - (u8, 123_u8), - (i16, 123_i16), - (u16, 123_u16), - (i32, 123_i32), - (u32, 123_u32), - (i64, 123_i64), - (u64, 123_u64), - (f32, 123_f32), - (f64, 123_f64) - } - - let o: IInspectable = "hello".try_into()?; - let v: HSTRING = (&o).try_into()?; - assert!("hello" == v); - let v: HSTRING = o.try_into()?; - assert!("hello" == v); - - let v = HSTRING::from("hello"); - let o: IInspectable = (&v).try_into()?; - let v: HSTRING = (&o).try_into()?; - assert!("hello" == v); - let v: HSTRING = o.try_into()?; - assert!("hello" == v); - - let v = HSTRING::from("hello"); - let o: IInspectable = v.try_into()?; - let v: HSTRING = o.try_into()?; - assert!("hello" == v); - - let o = IInspectable::try_from("hello")?; - assert_eq!("hello", HSTRING::try_from(&o)?); - assert_eq!("hello", HSTRING::try_from(o)?); - - Ok(()) -} - -#[test] -fn explicit_boxing() -> Result<()> { - let object = PropertyValue::CreateString(&HSTRING::from("hello"))?; - let pv: IPropertyValue = object.cast()?; - assert!(pv.GetString()? == "hello"); - - let object = PropertyValue::CreateUInt32Array(&[1, 2, 3])?; - let pv: IPropertyValue = object.cast()?; - let mut array = Array::new(); - assert!(array.is_empty()); - assert!(array.is_empty()); - - pv.GetUInt32Array(&mut array)?; - assert!(array[..] == [1, 2, 3]); - assert!(!array.is_empty()); - assert!(array.len() == 3); - - let object = - PropertyValue::CreateStringArray(&["Hello".into(), "Rust".into(), "WinRT".into()])?; - let pv: IPropertyValue = object.cast()?; - let mut array = Array::new(); - assert!(array.is_empty()); - assert!(array.is_empty()); - - pv.GetStringArray(&mut array)?; - assert!(array[..] == ["Hello", "Rust", "WinRT"]); - assert!(!array.is_empty()); - assert!(array.len() == 3); - array.clear(); - - Ok(()) -} - -#[test] -fn reference_array() -> Result<()> { - let object = PropertyValue::CreateInt32Array(&[1, 2, 3])?; - let array: IReferenceArray = object.cast()?; - let array: Array = array.Value()?; - assert_eq!(array[..], [1, 2, 3]); - Ok(()) -} diff --git a/crates/tests/winrt/tests/collections.rs b/crates/tests/winrt/tests/collections.rs index 3a491b4cab..aceb281658 100644 --- a/crates/tests/winrt/tests/collections.rs +++ b/crates/tests/winrt/tests/collections.rs @@ -3,7 +3,7 @@ use core::convert::*; use windows::{ core::Interface, Foundation::Collections::{IIterable, IVectorView, PropertySet}, - Foundation::{IWwwFormUrlDecoderEntry, Uri}, + Foundation::*, }; #[test] @@ -73,15 +73,15 @@ fn property_set() -> windows::core::Result<()> { set.Insert( &windows::core::HSTRING::from("A"), - &windows::core::IInspectable::try_from(1)?, + &PropertyValue::CreateInt32(1)?, )?; set.Insert( &windows::core::HSTRING::from("B"), - &windows::core::IInspectable::try_from(2)?, + &PropertyValue::CreateInt32(2)?, )?; set.Insert( &windows::core::HSTRING::from("C"), - &windows::core::IInspectable::try_from(3)?, + &PropertyValue::CreateInt32(3)?, )?; assert!(set.Size()? == 3); @@ -91,7 +91,7 @@ fn property_set() -> windows::core::Result<()> { for pair in &set { keys.push(pair.Key()?.to_string()); - values += i32::try_from(pair.Value()?)?; + values += pair.Value()?.cast::>()?.Value()?; } assert!(set.Size()? == 3); diff --git a/crates/tests/winrt/tests/delegates.rs b/crates/tests/winrt/tests/delegates.rs index 8301849715..2875e22fd3 100644 --- a/crates/tests/winrt/tests/delegates.rs +++ b/crates/tests/winrt/tests/delegates.rs @@ -1,11 +1,6 @@ use core::convert::*; -use windows::{ - Foundation::Collections::{ - CollectionChange, IObservableMap, MapChangedEventHandler, PropertySet, - }, - Foundation::{AsyncActionCompletedHandler, AsyncStatus, TypedEventHandler, Uri}, -}; +use windows::{Foundation::Collections::*, Foundation::*}; use windows::core::Interface; @@ -87,7 +82,7 @@ fn event() -> windows::core::Result<()> { set.Insert( &windows::core::HSTRING::from("A"), - &windows::core::IInspectable::try_from(1_u32)?, + &PropertyValue::CreateUInt32(1_u32)?, )?; assert!(rx.recv().unwrap()); diff --git a/crates/tools/bindings/src/core_com.txt b/crates/tools/bindings/src/core_com.txt index aab10831f8..75dd86e1fb 100644 --- a/crates/tools/bindings/src/core_com.txt +++ b/crates/tools/bindings/src/core_com.txt @@ -4,9 +4,6 @@ --config flatten minimal no-bindgen-comment --filter - Windows.Foundation.IReference - Windows.Foundation.IStringable - Windows.Foundation.PropertyValue Windows.Win32.Foundation.CO_E_NOTINITIALIZED Windows.Win32.Foundation.E_BOUNDS Windows.Win32.Foundation.E_NOINTERFACE