File tree 6 files changed +848
-4
lines changed
6 files changed +848
-4
lines changed Original file line number Diff line number Diff line change 42
42
- name : Install Vulkan loader
43
43
run : sudo apt-get install libvulkan-dev
44
44
- uses : actions/checkout@v4
45
+ - name : Checkout submodule
46
+ # Manually update submodules with --checkout because they are configured with update=none and will be skipped otherwise
47
+ run : git submodule update --recursive --init --force --checkout
45
48
- name : Test all targets
46
49
run : cargo test --workspace --all-targets
47
50
- name : Test docs
Original file line number Diff line number Diff line change @@ -4,3 +4,5 @@ version = "2.0.0"
4
4
edition = " 2021"
5
5
6
6
[dependencies ]
7
+ roxmltree = " 0.19"
8
+ tracing = " 0.1"
Original file line number Diff line number Diff line change 1
- use std :: path :: Path ;
1
+ mod xml ;
2
2
3
- pub struct Analysis { }
3
+ use std:: { fs, path:: Path } ;
4
+ use tracing:: { debug, error_span} ;
5
+
6
+ #[ derive( Debug ) ]
7
+ pub struct Analysis {
8
+ pub vk : Library ,
9
+ pub video : Library ,
10
+ }
4
11
5
12
impl Analysis {
6
- pub fn new ( _vulkan_headers_path : impl AsRef < Path > ) -> Analysis {
7
- Analysis { }
13
+ pub fn new ( vulkan_headers_path : impl AsRef < Path > ) -> Analysis {
14
+ let vulkan_headers_path = vulkan_headers_path. as_ref ( ) ;
15
+ Analysis {
16
+ vk : Library :: new ( vulkan_headers_path. join ( "registry/vk.xml" ) ) ,
17
+ video : Library :: new ( vulkan_headers_path. join ( "registry/video.xml" ) ) ,
18
+ }
19
+ }
20
+ }
21
+
22
+ #[ derive( Debug ) ]
23
+ pub struct Library {
24
+ _xml : xml:: Registry ,
25
+ }
26
+
27
+ impl Library {
28
+ fn new ( xml_path : impl AsRef < Path > ) -> Library {
29
+ let xml = error_span ! ( "xml" , path = %xml_path. as_ref( ) . display( ) ) . in_scope ( || {
30
+ // We leak the input string here for convenience, to avoid explicit lifetimes.
31
+ let xml_input = Box :: leak ( fs:: read_to_string ( xml_path) . unwrap ( ) . into_boxed_str ( ) ) ;
32
+ debug ! ( "parsing xml" ) ;
33
+ xml:: Registry :: parse ( xml_input, "vulkan" )
34
+ } ) ;
35
+
36
+ Library { _xml : xml }
8
37
}
9
38
}
You can’t perform that action at this time.
0 commit comments