webview2_com_sys/
lib.rs

1#[allow(
2    non_snake_case,
3    non_upper_case_globals,
4    non_camel_case_types,
5    dead_code,
6    clippy::all
7)]
8pub mod Microsoft {
9    pub mod Web {
10        pub mod WebView2 {
11            pub mod Win32 {
12                mod windows_link {
13                    macro_rules! link_webview2 {
14                        ($library:literal $abi:literal fn $($function:tt)*) => (
15                            #[cfg_attr(
16                                target_env = "msvc",
17                                link(name = "WebView2LoaderStatic", kind = "static")
18                            )]
19                            #[cfg_attr(
20                                not(target_env = "msvc"),
21                                link(name = "WebView2Loader.dll")
22                            )]
23                            extern $abi {
24                                pub fn $($function)*;
25                            }
26                        )
27                    }
28
29                    pub(crate) use link_webview2 as link;
30                }
31
32                include!("bindings.rs");
33            }
34        }
35    }
36}
37
38pub mod declared_interfaces;
39
40#[cfg(test)]
41mod test {
42    use windows_core::w;
43
44    use crate::Microsoft::Web::WebView2::Win32::*;
45
46    #[test]
47    fn compare_eq() {
48        let mut result = 1;
49        unsafe { CompareBrowserVersions(w!("1.0.0"), w!("1.0.0"), &mut result) }.unwrap();
50        assert_eq!(0, result);
51    }
52
53    #[test]
54    fn compare_lt() {
55        let mut result = 0;
56        unsafe { CompareBrowserVersions(w!("1.0.0"), w!("1.0.1"), &mut result) }.unwrap();
57        assert_eq!(-1, result);
58    }
59
60    #[test]
61    fn compare_gt() {
62        let mut result = 0;
63        unsafe { CompareBrowserVersions(w!("2.0.0"), w!("1.0.1"), &mut result) }.unwrap();
64        assert_eq!(1, result);
65    }
66}