1mod bindings;
2mod com_bindings;
3mod delay_load;
4mod factory_cache;
5mod generic_factory;
6mod heap;
7mod ref_count;
8mod sha1;
9mod waiter;
10mod weak_ref_count;
11
12pub use bindings::*;
13pub use com_bindings::*;
14pub use delay_load::*;
15pub use factory_cache::*;
16pub use generic_factory::*;
17pub use heap::*;
18pub use ref_count::*;
19pub use sha1::*;
20pub use waiter::*;
21pub use weak_ref_count::*;
22
23// This is a workaround since 1.56 does not include `bool::then_some`.
24pub fn then_some<T>(value: bool, t: T) -> Option<T> {
25 if value {
26 Some(t)
27 } else {
28 None
29 }
30}
31
32pub fn wide_trim_end(mut wide: &[u16]) -> &[u16] {
33 while let Some(last: &u16) = wide.last() {
34 match last {
35 32 | 9..=13 => wide = &wide[..wide.len() - 1],
36 _ => break,
37 }
38 }
39 wide
40}
41
42#[doc(hidden)]
43#[macro_export]
44macro_rules! interface_hierarchy {
45 ($child:ty, $parent:ty) => {
46 impl ::windows_core::CanInto<$parent> for $child {}
47 };
48 ($child:ty, $first:ty, $($rest:ty),+) => {
49 $crate::imp::interface_hierarchy!($child, $first);
50 $crate::imp::interface_hierarchy!($child, $($rest),+);
51 };
52}
53
54#[doc(hidden)]
55pub use interface_hierarchy;
56