#![feature(prelude_import)] #![no_std] #[prelude_import] use std::prelude::rust_2015::*; #[macro_use] extern crate std; extern crate intercom; use intercom::*; trait IFoo { fn trait_method(&self); } #[allow(non_snake_case)] #[allow(dead_code)] #[doc(hidden)] unsafe extern "system" fn __IFoo_trait_method_Automation( self_vtable: intercom::raw::RawComPtr, ) -> () where I: ?Sized, S: intercom::attributes::ComClassInterface + intercom::attributes::ComClass + IFoo, { let offset = >::offset(); let self_combox = (self_vtable as usize - offset) as *mut intercom::ComBoxData; intercom::logging::trace(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1( &["[", ", through ", "] Serving ", "::"], &[ ::core::fmt::ArgumentV1::new_pointer(&self_combox), ::core::fmt::ArgumentV1::new_pointer(&self_vtable), ::core::fmt::ArgumentV1::new_display(&std::any::type_name::()), ::core::fmt::ArgumentV1::new_display(&"trait_method"), ], ), ) }); let self_struct = &**self_combox; let __result = self_struct.trait_method(); intercom::logging::trace(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1( &["[", ", through ", "] Serving ", "::", ", OK"], &[ ::core::fmt::ArgumentV1::new_pointer(&self_combox), ::core::fmt::ArgumentV1::new_pointer(&self_vtable), ::core::fmt::ArgumentV1::new_display(&std::any::type_name::()), ::core::fmt::ArgumentV1::new_display(&"trait_method"), ], ), ) }); } #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] #[repr(C)] #[doc(hidden)] struct __IFooAutomationVTable { pub __base: >::VTable, pub trait_method: unsafe extern "system" fn(self_vtable: intercom::raw::RawComPtr) -> (), } #[automatically_derived] #[allow(unused_qualifications)] #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] impl ::core::clone::Clone for __IFooAutomationVTable { #[inline] fn clone(&self) -> __IFooAutomationVTable { { let _: ::core::clone::AssertParamIsClone< >::VTable, >; let _: ::core::clone::AssertParamIsClone< unsafe extern "system" fn(self_vtable: intercom::raw::RawComPtr) -> (), >; *self } } } #[automatically_derived] #[allow(unused_qualifications)] #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] impl ::core::marker::Copy for __IFooAutomationVTable {} #[allow(unused)] impl intercom::attributes::ComInterfaceVTableFor for dyn IFoo where I: ?Sized, S: intercom::attributes::ComClassInterface + intercom::attributes::ComClass + IFoo, { const VTABLE: __IFooAutomationVTable = __IFooAutomationVTable { __base: >::VTABLE, trait_method: __IFoo_trait_method_Automation::, }; } #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] #[doc(hidden)] impl intercom::attributes::ComInterfaceVariant for dyn IFoo { type VTable = __IFooAutomationVTable; fn iid() -> &'static intercom::IID { &intercom::GUID { data1: 0u32, data2: 0u16, data3: 0u16, data4: [0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8], } } } #[allow(non_snake_case)] #[allow(dead_code)] #[doc(hidden)] unsafe extern "system" fn __IFoo_trait_method_Raw(self_vtable: intercom::raw::RawComPtr) -> () where I: ?Sized, S: intercom::attributes::ComClassInterface + intercom::attributes::ComClass + IFoo, { let offset = >::offset(); let self_combox = (self_vtable as usize - offset) as *mut intercom::ComBoxData; intercom::logging::trace(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1( &["[", ", through ", "] Serving ", "::"], &[ ::core::fmt::ArgumentV1::new_pointer(&self_combox), ::core::fmt::ArgumentV1::new_pointer(&self_vtable), ::core::fmt::ArgumentV1::new_display(&std::any::type_name::()), ::core::fmt::ArgumentV1::new_display(&"trait_method"), ], ), ) }); let self_struct = &**self_combox; let __result = self_struct.trait_method(); intercom::logging::trace(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1( &["[", ", through ", "] Serving ", "::", ", OK"], &[ ::core::fmt::ArgumentV1::new_pointer(&self_combox), ::core::fmt::ArgumentV1::new_pointer(&self_vtable), ::core::fmt::ArgumentV1::new_display(&std::any::type_name::()), ::core::fmt::ArgumentV1::new_display(&"trait_method"), ], ), ) }); } #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] #[repr(C)] #[doc(hidden)] struct __IFooRawVTable { pub __base: >::VTable, pub trait_method: unsafe extern "system" fn(self_vtable: intercom::raw::RawComPtr) -> (), } #[automatically_derived] #[allow(unused_qualifications)] #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] impl ::core::clone::Clone for __IFooRawVTable { #[inline] fn clone(&self) -> __IFooRawVTable { { let _: ::core::clone::AssertParamIsClone< >::VTable, >; let _: ::core::clone::AssertParamIsClone< unsafe extern "system" fn(self_vtable: intercom::raw::RawComPtr) -> (), >; *self } } } #[automatically_derived] #[allow(unused_qualifications)] #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] impl ::core::marker::Copy for __IFooRawVTable {} #[allow(unused)] impl intercom::attributes::ComInterfaceVTableFor for dyn IFoo where I: ?Sized, S: intercom::attributes::ComClassInterface + intercom::attributes::ComClass + IFoo, { const VTABLE: __IFooRawVTable = __IFooRawVTable { __base: >::VTABLE, trait_method: __IFoo_trait_method_Raw::, }; } #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] #[doc(hidden)] impl intercom::attributes::ComInterfaceVariant for dyn IFoo { type VTable = __IFooRawVTable; fn iid() -> &'static intercom::IID { &intercom::GUID { data1: 0u32, data2: 0u16, data3: 0u16, data4: [0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8], } } } #[allow(clippy::all)] #[allow(unused_braces)] impl IFoo for intercom::ComItf { fn trait_method(&self) -> () { intercom::logging::trace(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1( &["[", "] Calling ", "::"], &[ ::core::fmt::ArgumentV1::new_pointer(&self), ::core::fmt::ArgumentV1::new_display(&"IFoo"), ::core::fmt::ArgumentV1::new_display(&"trait_method"), ], ), ) }); #[allow(unused_imports)] use intercom::ErrorValue; if let Some(comptr) = intercom::ComItf::ptr::(self) { intercom::logging::trace(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1( &["[", ", with ", "] Calling ", "::", ", type system: "], &[ ::core::fmt::ArgumentV1::new_pointer(&self), ::core::fmt::ArgumentV1::new_pointer(&comptr.ptr), ::core::fmt::ArgumentV1::new_display(&"IFoo"), ::core::fmt::ArgumentV1::new_display(&"trait_method"), ::core::fmt::ArgumentV1::new_display(&"Automation"), ], ), ) }); #[allow(unused_imports)] let vtbl = comptr.ptr.as_ptr() as *const *const >::VTable; #[allow(unused_unsafe)] unsafe { let __result = ((**vtbl).trait_method)(comptr.ptr.as_ptr()); let __intercom_iid = intercom::GUID { data1: 0u32, data2: 0u16, data3: 0u16, data4: [0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8], }; #[allow(unused_braces)] return {}; } } if let Some(comptr) = intercom::ComItf::ptr::(self) { intercom::logging::trace(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1( &["[", ", with ", "] Calling ", "::", ", type system: "], &[ ::core::fmt::ArgumentV1::new_pointer(&self), ::core::fmt::ArgumentV1::new_pointer(&comptr.ptr), ::core::fmt::ArgumentV1::new_display(&"IFoo"), ::core::fmt::ArgumentV1::new_display(&"trait_method"), ::core::fmt::ArgumentV1::new_display(&"Raw"), ], ), ) }); #[allow(unused_imports)] let vtbl = comptr.ptr.as_ptr() as *const *const >::VTable; #[allow(unused_unsafe)] unsafe { let __result = ((**vtbl).trait_method)(comptr.ptr.as_ptr()); let __intercom_iid = intercom::GUID { data1: 0u32, data2: 0u16, data3: 0u16, data4: [0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8], }; #[allow(unused_braces)] return {}; } } ::core::panicking::panic("internal error: entered unreachable code"); } } impl intercom::attributes::ComInterface for dyn IFoo { type TSelf = dyn IFoo; #[doc = "Returns the IID of the requested interface."] fn iid_ts() -> &'static intercom::IID where Self: intercom::attributes::ComInterfaceVariant, { >::iid() } fn iid(ts: intercom::type_system::TypeSystemName) -> Option<&'static intercom::IID> { match ts { intercom::type_system::TypeSystemName::Automation => { Some(>::iid()) } intercom::type_system::TypeSystemName::Raw => { Some(>::iid()) } } } fn deref(com_itf: &intercom::ComItf) -> &(dyn IFoo + 'static) { com_itf } } impl intercom::type_system::ForeignType for dyn IFoo { #[doc = r" The name of the type."] fn type_name() -> &'static str { "IFoo" } } #[allow(non_snake_case)] #[allow(dead_code)] impl intercom::attributes::ComInterfaceTypeInfo for dyn IFoo { fn gather_type_info() -> Vec { let variants = <[_]>::into_vec( #[rustc_box] ::alloc::boxed::Box::new([ intercom::ComBox::new(intercom::typelib::InterfaceVariant { ts: intercom::type_system::TypeSystemName::Automation, iid: intercom::GUID { data1: 0u32, data2: 0u16, data3: 0u16, data4: [0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8], }, methods: <[_]>::into_vec( #[rustc_box] ::alloc::boxed::Box::new([intercom::ComBox::new( intercom::typelib::Method { name: "trait_method".into(), return_type: intercom::typelib::Arg { name: "".into(), ty: "void".into(), indirection_level: 0, direction: intercom::typelib::Direction::Return, }, parameters: ::alloc::vec::Vec::new(), }, )]), ), }), intercom::ComBox::new(intercom::typelib::InterfaceVariant { ts: intercom::type_system::TypeSystemName::Raw, iid: intercom::GUID { data1: 0u32, data2: 0u16, data3: 0u16, data4: [0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8], }, methods: <[_]>::into_vec( #[rustc_box] ::alloc::boxed::Box::new([intercom::ComBox::new( intercom::typelib::Method { name: "trait_method".into(), return_type: intercom::typelib::Arg { name: "".into(), ty: "void".into(), indirection_level: 0, direction: intercom::typelib::Direction::Return, }, parameters: ::alloc::vec::Vec::new(), }, )]), ), }), ]), ); <[_]>::into_vec( #[rustc_box] ::alloc::boxed::Box::new([intercom::typelib::TypeInfo::Interface( intercom::ComBox::new(intercom::typelib::Interface { name: "IFoo".into(), variants, options: intercom::typelib::InterfaceOptions { class_impl_interface: false, ..Default::default() }, }), )]), ) } } struct Foo; impl intercom::IUnknown for Foo {} impl intercom::attributes::HasInterface for Foo {} #[allow(non_snake_case)] impl intercom::attributes::ComClassInterface for Foo { #[inline(always)] fn offset() -> usize { unsafe { &intercom::ComBoxData::::null_vtable().Foo_Automation as *const _ as usize } } } #[allow(non_snake_case)] impl intercom::attributes::ComClassInterface for Foo { #[inline(always)] fn offset() -> usize { unsafe { &intercom::ComBoxData::::null_vtable().Foo_Raw as *const _ as usize } } } impl intercom::attributes::HasInterface for Foo {} #[allow(non_snake_case)] impl intercom::attributes::ComClassInterface for Foo { #[inline(always)] fn offset() -> usize { unsafe { &intercom::ComBoxData::::null_vtable().IFoo_Automation as *const _ as usize } } } #[allow(non_snake_case)] impl intercom::attributes::ComClassInterface for Foo { #[inline(always)] fn offset() -> usize { unsafe { &intercom::ComBoxData::::null_vtable().IFoo_Raw as *const _ as usize } } } #[allow(non_snake_case)] impl intercom::attributes::ComClassInterface< dyn intercom::ISupportErrorInfo, intercom::type_system::AutomationTypeSystem, > for Foo { #[inline(always)] fn offset() -> usize { 0 } } impl intercom::attributes::HasInterface for Foo {} #[allow(non_snake_case)] #[doc(hidden)] struct __intercom_vtable_for_Foo { _ISupportErrorInfo: &'static >::VTable, Foo_Automation: &'static <::TSelf as intercom::attributes::ComInterfaceVariant>::VTable, Foo_Raw: &'static <::TSelf as intercom::attributes::ComInterfaceVariant>::VTable, IFoo_Automation: &'static <::TSelf as intercom::attributes::ComInterfaceVariant>::VTable, IFoo_Raw: &'static <::TSelf as intercom::attributes::ComInterfaceVariant>::VTable, } #[automatically_derived] #[allow(unused_qualifications)] #[allow(non_snake_case)] impl ::core::clone::Clone for __intercom_vtable_for_Foo { #[inline] fn clone(&self) -> __intercom_vtable_for_Foo { { let _: ::core::clone::AssertParamIsClone<&'static >::VTable>; let _: ::core::clone::AssertParamIsClone<&'static <::TSelf as intercom::attributes::ComInterfaceVariant>::VTable>; let _: ::core::clone::AssertParamIsClone<&'static <::TSelf as intercom::attributes::ComInterfaceVariant>::VTable>; let _: ::core::clone::AssertParamIsClone<&'static <::TSelf as intercom::attributes::ComInterfaceVariant>::VTable>; let _: ::core::clone::AssertParamIsClone<&'static <::TSelf as intercom::attributes::ComInterfaceVariant>::VTable>; *self } } } #[automatically_derived] #[allow(unused_qualifications)] #[allow(non_snake_case)] impl ::core::marker::Copy for __intercom_vtable_for_Foo {} #[allow(non_snake_case)] struct Static__intercom_vtable_for_Foo { Foo_Automation: <::TSelf as intercom::attributes::ComInterfaceVariant>::VTable, Foo_Raw: <::TSelf as intercom::attributes::ComInterfaceVariant>::VTable, IFoo_Automation: <::TSelf as intercom::attributes::ComInterfaceVariant>::VTable, IFoo_Raw: <::TSelf as intercom::attributes::ComInterfaceVariant>::VTable, } #[allow(clippy::all)] impl intercom::attributes::ComClass for Foo { type VTableList = __intercom_vtable_for_Foo; const VTABLE: Self::VTableList = __intercom_vtable_for_Foo { _ISupportErrorInfo: &>::VTABLE, Foo_Automation: &>::VTABLE, Foo_Raw: &>::VTABLE, IFoo_Automation: &>::VTABLE, IFoo_Raw: &>::VTABLE, }; fn query_interface( vtables: &Self::VTableList, riid: intercom::REFIID, ) -> intercom::RawComResult { if riid.is_null() { intercom::logging::error(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1( &["[", "] ", "::query_interface(NULL)"], &[ ::core::fmt::ArgumentV1::new_pointer(&vtables), ::core::fmt::ArgumentV1::new_display(&"Foo"), ], ), ) }); return Err(intercom::raw::E_NOINTERFACE); } unsafe { let riid = &*riid; intercom::logging::trace(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1_formatted( &["[", "] ", "::query_interface(", ")"], &[ ::core::fmt::ArgumentV1::new_pointer(&vtables), ::core::fmt::ArgumentV1::new_display(&"Foo"), ::core::fmt::ArgumentV1::new_upper_hex(&riid), ], &[ ::core::fmt::rt::v1::Argument { position: 0usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 1usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 2usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 2u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ], unsafe { ::core::fmt::UnsafeArg::new() }, ), ) }); Ok(if riid == >::iid() { let ptr = (&vtables._ISupportErrorInfo) as *const &>::VTable as *mut &>::VTable as intercom::raw::RawComPtr; intercom::logging::trace(|l| l("testcrate", ::core::fmt::Arguments::new_v1_formatted(&["[", "] ", "::query_interface(", ") -> IUnknown [", "]"], &[::core::fmt::ArgumentV1::new_pointer(&vtables), ::core::fmt::ArgumentV1::new_display(&"Foo"), ::core::fmt::ArgumentV1::new_upper_hex(&riid), ::core::fmt::ArgumentV1::new_pointer(&ptr)], &[::core::fmt::rt::v1::Argument { position: 0usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 1usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 2usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 2u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 3usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }], unsafe { ::core::fmt::UnsafeArg::new() }))); ptr } else if riid == >::iid() { let ptr = (&vtables._ISupportErrorInfo) as *const &>::VTable as *mut &>::VTable as intercom::raw::RawComPtr; intercom::logging::trace(|l| l("testcrate", ::core::fmt::Arguments::new_v1_formatted(&["[", "] ", "::query_interface(", ") -> ISupportErrorInfo [", "]"], &[::core::fmt::ArgumentV1::new_pointer(&vtables), ::core::fmt::ArgumentV1::new_display(&"Foo"), ::core::fmt::ArgumentV1::new_upper_hex(&riid), ::core::fmt::ArgumentV1::new_pointer(&ptr)], &[::core::fmt::rt::v1::Argument { position: 0usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 1usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 2usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 2u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 3usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }], unsafe { ::core::fmt::UnsafeArg::new() }))); ptr } else if riid == <::TSelf as intercom::attributes::ComInterfaceVariant>::iid() { let ptr = &vtables.Foo_Automation as *const &<::TSelf as intercom::attributes::ComInterfaceVariant>::VTable as *mut &<::TSelf as intercom::attributes::ComInterfaceVariant>::VTable as intercom::raw::RawComPtr; intercom::logging::trace(|l| l("testcrate", ::core::fmt::Arguments::new_v1_formatted(&["[", "] ", "::query_interface(", ") -> ", " (", ") [", "]"], &[::core::fmt::ArgumentV1::new_pointer(&vtables), ::core::fmt::ArgumentV1::new_display(&"Foo"), ::core::fmt::ArgumentV1::new_upper_hex(&riid), ::core::fmt::ArgumentV1::new_display(&"Foo"), ::core::fmt::ArgumentV1::new_display(&"Automation"), ::core::fmt::ArgumentV1::new_pointer(&ptr)], &[::core::fmt::rt::v1::Argument { position: 0usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 1usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 2usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 2u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 3usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 4usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 5usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }], unsafe { ::core::fmt::UnsafeArg::new() }))); ptr } else if riid == <::TSelf as intercom::attributes::ComInterfaceVariant>::iid() { let ptr = &vtables.Foo_Raw as *const &<::TSelf as intercom::attributes::ComInterfaceVariant>::VTable as *mut &<::TSelf as intercom::attributes::ComInterfaceVariant>::VTable as intercom::raw::RawComPtr; intercom::logging::trace(|l| l("testcrate", ::core::fmt::Arguments::new_v1_formatted(&["[", "] ", "::query_interface(", ") -> ", " (", ") [", "]"], &[::core::fmt::ArgumentV1::new_pointer(&vtables), ::core::fmt::ArgumentV1::new_display(&"Foo"), ::core::fmt::ArgumentV1::new_upper_hex(&riid), ::core::fmt::ArgumentV1::new_display(&"Foo"), ::core::fmt::ArgumentV1::new_display(&"Raw"), ::core::fmt::ArgumentV1::new_pointer(&ptr)], &[::core::fmt::rt::v1::Argument { position: 0usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 1usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 2usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 2u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 3usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 4usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 5usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }], unsafe { ::core::fmt::UnsafeArg::new() }))); ptr } else if riid == <::TSelf as intercom::attributes::ComInterfaceVariant>::iid() { let ptr = &vtables.IFoo_Automation as *const &<::TSelf as intercom::attributes::ComInterfaceVariant>::VTable as *mut &<::TSelf as intercom::attributes::ComInterfaceVariant>::VTable as intercom::raw::RawComPtr; intercom::logging::trace(|l| l("testcrate", ::core::fmt::Arguments::new_v1_formatted(&["[", "] ", "::query_interface(", ") -> ", " (", ") [", "]"], &[::core::fmt::ArgumentV1::new_pointer(&vtables), ::core::fmt::ArgumentV1::new_display(&"Foo"), ::core::fmt::ArgumentV1::new_upper_hex(&riid), ::core::fmt::ArgumentV1::new_display(&"IFoo"), ::core::fmt::ArgumentV1::new_display(&"Automation"), ::core::fmt::ArgumentV1::new_pointer(&ptr)], &[::core::fmt::rt::v1::Argument { position: 0usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 1usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 2usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 2u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 3usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 4usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 5usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }], unsafe { ::core::fmt::UnsafeArg::new() }))); ptr } else if riid == <::TSelf as intercom::attributes::ComInterfaceVariant>::iid() { let ptr = &vtables.IFoo_Raw as *const &<::TSelf as intercom::attributes::ComInterfaceVariant>::VTable as *mut &<::TSelf as intercom::attributes::ComInterfaceVariant>::VTable as intercom::raw::RawComPtr; intercom::logging::trace(|l| l("testcrate", ::core::fmt::Arguments::new_v1_formatted(&["[", "] ", "::query_interface(", ") -> ", " (", ") [", "]"], &[::core::fmt::ArgumentV1::new_pointer(&vtables), ::core::fmt::ArgumentV1::new_display(&"Foo"), ::core::fmt::ArgumentV1::new_upper_hex(&riid), ::core::fmt::ArgumentV1::new_display(&"IFoo"), ::core::fmt::ArgumentV1::new_display(&"Raw"), ::core::fmt::ArgumentV1::new_pointer(&ptr)], &[::core::fmt::rt::v1::Argument { position: 0usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 1usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 2usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 2u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 3usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 4usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 5usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }], unsafe { ::core::fmt::UnsafeArg::new() }))); ptr } else { intercom::logging::trace(|l| l("testcrate", ::core::fmt::Arguments::new_v1_formatted(&["[", "] ", "::query_interface(", ") -> E_NOINTERFACE"], &[::core::fmt::ArgumentV1::new_pointer(&vtables), ::core::fmt::ArgumentV1::new_display(&"Foo"), ::core::fmt::ArgumentV1::new_upper_hex(&riid)], &[::core::fmt::rt::v1::Argument { position: 0usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 1usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 0u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }, ::core::fmt::rt::v1::Argument { position: 2usize, format: ::core::fmt::rt::v1::FormatSpec { fill: ' ', align: ::core::fmt::rt::v1::Alignment::Unknown, flags: 2u32, precision: ::core::fmt::rt::v1::Count::Implied, width: ::core::fmt::rt::v1::Count::Implied, }, }], unsafe { ::core::fmt::UnsafeArg::new() }))); return Err(intercom::raw::E_NOINTERFACE) }) } } fn interface_supports_error_info(riid: intercom::REFIID) -> bool { if riid.is_null() { return false; } unsafe { let riid = &*riid; if riid == <::TSelf as intercom::attributes::ComInterfaceVariant>::iid() { true } else if riid == <::TSelf as intercom::attributes::ComInterfaceVariant>::iid() { true } else if riid == <::TSelf as intercom::attributes::ComInterfaceVariant>::iid() { true } else if riid == <::TSelf as intercom::attributes::ComInterfaceVariant>::iid() { true } else { false } } } } #[allow(non_upper_case_globals)] #[doc = "`Foo` class ID."] pub const CLSID_Foo: intercom::CLSID = intercom::GUID { data1: 0u32, data2: 0u16, data3: 0u16, data4: [0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8], }; impl intercom::attributes::ComClassTypeInfo for Foo { fn gather_type_info() -> Vec { let mut r = <[_]>::into_vec(#[rustc_box] ::alloc::boxed::Box::new([intercom::typelib::TypeInfo::Class(intercom::ComBox::new(intercom::typelib::CoClass::__new("Foo".into(), intercom::GUID { data1: 0u32, data2: 0u16, data3: 0u16, data4: [0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8], }, <[_]>::into_vec(#[rustc_box] ::alloc::boxed::Box::new([intercom::typelib::InterfaceRef { name: "Foo".into(), iid_automation: <::TSelf as intercom::attributes::ComInterfaceVariant>::iid().clone(), iid_raw: <::TSelf as intercom::attributes::ComInterfaceVariant>::iid().clone(), }, intercom::typelib::InterfaceRef { name: "IFoo".into(), iid_automation: <::TSelf as intercom::attributes::ComInterfaceVariant>::iid().clone(), iid_raw: <::TSelf as intercom::attributes::ComInterfaceVariant>::iid().clone(), }])))))])); r.extend(::gather_type_info()); r.extend(::gather_type_info()); r } } impl Foo { pub fn struct_method(&self) {} } #[allow(non_snake_case)] #[allow(dead_code)] #[doc(hidden)] unsafe extern "system" fn __Foo_struct_method_Automation( self_vtable: intercom::raw::RawComPtr, ) -> () { let offset = >::offset(); let self_combox = (self_vtable as usize - offset) as *mut intercom::ComBoxData; intercom::logging::trace(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1( &["[", ", through ", "] Serving ", "::"], &[ ::core::fmt::ArgumentV1::new_pointer(&self_combox), ::core::fmt::ArgumentV1::new_pointer(&self_vtable), ::core::fmt::ArgumentV1::new_display(&std::any::type_name::()), ::core::fmt::ArgumentV1::new_display(&"struct_method"), ], ), ) }); let self_struct = &**self_combox; let __result = self_struct.struct_method(); intercom::logging::trace(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1( &["[", ", through ", "] Serving ", "::", ", OK"], &[ ::core::fmt::ArgumentV1::new_pointer(&self_combox), ::core::fmt::ArgumentV1::new_pointer(&self_vtable), ::core::fmt::ArgumentV1::new_display(&std::any::type_name::()), ::core::fmt::ArgumentV1::new_display(&"struct_method"), ], ), ) }); } #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] #[repr(C)] #[doc(hidden)] pub struct __FooAutomationVTable { pub __base: >::VTable, pub struct_method: unsafe extern "system" fn(self_vtable: intercom::raw::RawComPtr) -> (), } #[automatically_derived] #[allow(unused_qualifications)] #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] impl ::core::clone::Clone for __FooAutomationVTable { #[inline] fn clone(&self) -> __FooAutomationVTable { { let _: ::core::clone::AssertParamIsClone< >::VTable, >; let _: ::core::clone::AssertParamIsClone< unsafe extern "system" fn(self_vtable: intercom::raw::RawComPtr) -> (), >; *self } } } #[automatically_derived] #[allow(unused_qualifications)] #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] impl ::core::marker::Copy for __FooAutomationVTable {} #[allow(unused)] impl intercom::attributes::ComInterfaceVTableFor for Foo where I: ?Sized, S: intercom::attributes::ComClassInterface + intercom::attributes::ComClass, { const VTABLE: __FooAutomationVTable = __FooAutomationVTable { __base: >::VTABLE, struct_method: __Foo_struct_method_Automation, }; } #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] #[doc(hidden)] impl intercom::attributes::ComInterfaceVariant for Foo { type VTable = __FooAutomationVTable; fn iid() -> &'static intercom::IID { &intercom::GUID { data1: 0u32, data2: 0u16, data3: 0u16, data4: [0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 2u8], } } } #[allow(non_snake_case)] #[allow(dead_code)] #[doc(hidden)] unsafe extern "system" fn __Foo_struct_method_Raw(self_vtable: intercom::raw::RawComPtr) -> () { let offset = >::offset(); let self_combox = (self_vtable as usize - offset) as *mut intercom::ComBoxData; intercom::logging::trace(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1( &["[", ", through ", "] Serving ", "::"], &[ ::core::fmt::ArgumentV1::new_pointer(&self_combox), ::core::fmt::ArgumentV1::new_pointer(&self_vtable), ::core::fmt::ArgumentV1::new_display(&std::any::type_name::()), ::core::fmt::ArgumentV1::new_display(&"struct_method"), ], ), ) }); let self_struct = &**self_combox; let __result = self_struct.struct_method(); intercom::logging::trace(|l| { l( "testcrate", ::core::fmt::Arguments::new_v1( &["[", ", through ", "] Serving ", "::", ", OK"], &[ ::core::fmt::ArgumentV1::new_pointer(&self_combox), ::core::fmt::ArgumentV1::new_pointer(&self_vtable), ::core::fmt::ArgumentV1::new_display(&std::any::type_name::()), ::core::fmt::ArgumentV1::new_display(&"struct_method"), ], ), ) }); } #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] #[repr(C)] #[doc(hidden)] pub struct __FooRawVTable { pub __base: >::VTable, pub struct_method: unsafe extern "system" fn(self_vtable: intercom::raw::RawComPtr) -> (), } #[automatically_derived] #[allow(unused_qualifications)] #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] impl ::core::clone::Clone for __FooRawVTable { #[inline] fn clone(&self) -> __FooRawVTable { { let _: ::core::clone::AssertParamIsClone< >::VTable, >; let _: ::core::clone::AssertParamIsClone< unsafe extern "system" fn(self_vtable: intercom::raw::RawComPtr) -> (), >; *self } } } #[automatically_derived] #[allow(unused_qualifications)] #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] impl ::core::marker::Copy for __FooRawVTable {} #[allow(unused)] impl intercom::attributes::ComInterfaceVTableFor for Foo where I: ?Sized, S: intercom::attributes::ComClassInterface + intercom::attributes::ComClass, { const VTABLE: __FooRawVTable = __FooRawVTable { __base: >::VTABLE, struct_method: __Foo_struct_method_Raw, }; } #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(clippy::all)] #[doc(hidden)] impl intercom::attributes::ComInterfaceVariant for Foo { type VTable = __FooRawVTable; fn iid() -> &'static intercom::IID { &intercom::GUID { data1: 0u32, data2: 0u16, data3: 0u16, data4: [0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 3u8], } } } impl intercom::attributes::ComInterface for Foo { type TSelf = Foo; #[doc = "Returns the IID of the requested interface."] fn iid_ts() -> &'static intercom::IID where Self: intercom::attributes::ComInterfaceVariant, { >::iid() } fn iid(ts: intercom::type_system::TypeSystemName) -> Option<&'static intercom::IID> { match ts { intercom::type_system::TypeSystemName::Automation => { Some(>::iid()) } intercom::type_system::TypeSystemName::Raw => { Some(>::iid()) } } } fn deref(com_itf: &intercom::ComItf) -> &Foo { let some_iunk: &intercom::ComItf = com_itf.as_raw_iunknown(); let iunknown_iid = ::iid(intercom::type_system::TypeSystemName::Automation) .expect("IUnknown must have Automation IID"); let primary_iunk = some_iunk .query_interface(iunknown_iid) .expect("All types must implement IUnknown"); let combox: *mut intercom::ComBoxData = primary_iunk as *mut intercom::ComBoxData; unsafe { intercom::ComBoxData::release(combox); use std::ops::Deref; (*combox).deref() } } } impl intercom::type_system::ForeignType for Foo { #[doc = r" The name of the type."] fn type_name() -> &'static str { "Foo" } } #[allow(non_snake_case)] #[allow(dead_code)] impl intercom::attributes::ComInterfaceTypeInfo for Foo { fn gather_type_info() -> Vec { let variants = <[_]>::into_vec( #[rustc_box] ::alloc::boxed::Box::new([ intercom::ComBox::new(intercom::typelib::InterfaceVariant { ts: intercom::type_system::TypeSystemName::Automation, iid: intercom::GUID { data1: 0u32, data2: 0u16, data3: 0u16, data4: [0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 2u8], }, methods: <[_]>::into_vec( #[rustc_box] ::alloc::boxed::Box::new([intercom::ComBox::new( intercom::typelib::Method { name: "struct_method".into(), return_type: intercom::typelib::Arg { name: "".into(), ty: "void".into(), indirection_level: 0, direction: intercom::typelib::Direction::Return, }, parameters: ::alloc::vec::Vec::new(), }, )]), ), }), intercom::ComBox::new(intercom::typelib::InterfaceVariant { ts: intercom::type_system::TypeSystemName::Raw, iid: intercom::GUID { data1: 0u32, data2: 0u16, data3: 0u16, data4: [0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 3u8], }, methods: <[_]>::into_vec( #[rustc_box] ::alloc::boxed::Box::new([intercom::ComBox::new( intercom::typelib::Method { name: "struct_method".into(), return_type: intercom::typelib::Arg { name: "".into(), ty: "void".into(), indirection_level: 0, direction: intercom::typelib::Direction::Return, }, parameters: ::alloc::vec::Vec::new(), }, )]), ), }), ]), ); <[_]>::into_vec( #[rustc_box] ::alloc::boxed::Box::new([intercom::typelib::TypeInfo::Interface( intercom::ComBox::new(intercom::typelib::Interface { name: "Foo".into(), variants, options: intercom::typelib::InterfaceOptions { class_impl_interface: true, ..Default::default() }, }), )]), ) } } impl IFoo for Foo { fn trait_method(&self) {} }