Debian Codegraph @

.cargo/vendor/windows-core/src/imp/mod.rs

raw
1 mod bindings;
2 mod com_bindings;
3 mod delay_load;
4 mod factory_cache;
5 mod generic_factory;
6 mod heap;
7 mod ref_count;
8 mod sha1;
9 mod waiter;
10 mod weak_ref_count;
11
12 pub use bindings::*;
13 pub use com_bindings::*;
14 pub use delay_load::*;
15 pub use factory_cache::*;
16 pub use generic_factory::*;
17 pub use heap::*;
18 pub use ref_count::*;
19 pub use sha1::*;
20 pub use waiter::*;
21 pub use weak_ref_count::*;
22
23 // This is a workaround since 1.56 does not include `bool::then_some`.
24 pub fn then_some<T>(value: bool, t: T) -> Option<T> {
25 if value {
26 Some(t)
27 } else {
28 None
29 }
30 }
31
32 pub fn wide_trim_end(mut wide: &[u16]) -> &[u16] {
33 while let Some(last) = 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]
44 macro_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)]
55 pub use interface_hierarchy;