1#[cfg(windows)]
2include!("windows.rs");
3
4mod can_into;
5mod com_bindings;
6mod ref_count;
7mod sha1;
8mod weak_ref_count;
9
10pub use can_into::*;
11pub use com_bindings::*;
12pub use ref_count::*;
13pub use sha1::*;
14pub use weak_ref_count::*;
15
16#[doc(hidden)]
17#[macro_export]
18macro_rules! interface_hierarchy {
19 ($child:ident, $parent:ty) => {
20 impl ::windows_core::imp::CanInto<$parent> for $child {}
21 impl ::core::convert::From<&$child> for &$parent {
22 fn from(value: &$child) -> Self {
23 unsafe { ::core::mem::transmute(value) }
24 }
25 }
26 impl ::core::convert::From<$child> for $parent {
27 fn from(value: $child) -> Self {
28 unsafe { ::core::mem::transmute(value) }
29 }
30 }
31 };
32 ($child:ident, $first:ty, $($rest:ty),+) => {
33 $crate::imp::interface_hierarchy!($child, $first);
34 $crate::imp::interface_hierarchy!($child, $($rest),+);
35 };
36}
37
38#[doc(hidden)]
39pub use interface_hierarchy;
40
41#[doc(hidden)]
42#[macro_export]
43macro_rules! required_hierarchy {
44 ($child:ident, $parent:ty) => {
45 impl ::windows_core::imp::CanInto<$parent> for $child { const QUERY: bool = true; }
46 };
47 ($child:ident, $first:ty, $($rest:ty),+) => {
48 $crate::imp::required_hierarchy!($child, $first);
49 $crate::imp::required_hierarchy!($child, $($rest),+);
50 };
51}
52
53#[doc(hidden)]
54pub use required_hierarchy;
55
56#[doc(hidden)]
57#[macro_export]
58macro_rules! define_interface {
59 ($name:ident, $vtbl:ident, $iid:literal) => {
60 #[repr(transparent)]
61 #[derive(::core::cmp::PartialEq, ::core::cmp::Eq, ::core::clone::Clone)]
62 pub struct $name(::windows_core::IUnknown);
63 unsafe impl ::windows_core::Interface for $name {
64 type Vtable = $vtbl;
65 const IID: ::windows_core::GUID = ::windows_core::GUID::from_u128($iid);
66 }
67 impl ::core::fmt::Debug for $name {
68 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> core::fmt::Result {
69 f.debug_tuple(stringify!($name))
70 .field(&::windows_core::Interface::as_raw(self))
71 .finish()
72 }
73 }
74 };
75 ($name:ident, $vtbl:ident) => {
76 #[repr(transparent)]
77 #[derive(::core::cmp::PartialEq, ::core::cmp::Eq, ::core::clone::Clone)]
78 pub struct $name(::core::ptr::NonNull<::core::ffi::c_void>);
79 unsafe impl ::windows_core::Interface for $name {
80 type Vtable = $vtbl;
81 const IID: ::windows_core::GUID = ::windows_core::GUID::zeroed();
82 const UNKNOWN: bool = false;
83 }
84 impl ::core::fmt::Debug for $name {
85 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> core::fmt::Result {
86 f.debug_tuple(stringify!($name)).field(&self.0).finish()
87 }
88 }
89 };
90}
91
92#[doc(hidden)]
93pub use define_interface;
94
95#[doc(hidden)]
96pub use alloc::boxed::Box;
97