File tree 1 file changed +25
-4
lines changed
1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,23 @@ impl NemoError {
68
68
}
69
69
}
70
70
71
+ #[ wasm_bindgen]
72
+ pub struct NemoResource {
73
+ accept : String ,
74
+ url : String ,
75
+ }
76
+
77
+ #[ wasm_bindgen]
78
+ impl NemoResource {
79
+ pub fn accept ( & self ) -> String {
80
+ self . accept . clone ( )
81
+ }
82
+
83
+ pub fn url ( & self ) -> String {
84
+ self . url . clone ( )
85
+ }
86
+ }
87
+
71
88
#[ wasm_bindgen]
72
89
impl NemoProgram {
73
90
#[ wasm_bindgen( constructor) ]
@@ -95,16 +112,20 @@ impl NemoProgram {
95
112
/// just make sure that things validate upon creation, and make sure that problems
96
113
/// are detected early.
97
114
#[ wasm_bindgen( js_name = "getResourcesUsedInImports" ) ]
98
- pub fn resources_used_in_imports ( & self ) -> Set {
99
- let js_set = Set :: new ( & JsValue :: undefined ( ) ) ;
115
+ pub fn resources_used_in_imports ( & self ) -> Vec < NemoResource > {
116
+ let mut result : Vec < NemoResource > = vec ! [ ] ;
100
117
101
118
for directive in self . 0 . imports ( ) {
119
+ let format = directive. file_format ( ) . media_type ( ) ;
102
120
if let Some ( resource) = directive. attributes ( ) . get ( & ImportExportAttribute :: Resource ) {
103
- js_set. add ( & JsValue :: from ( resource. to_string ( ) ) ) ;
121
+ result. push ( NemoResource {
122
+ accept : format. to_string ( ) ,
123
+ url : resource. to_string ( ) ,
124
+ } ) ;
104
125
}
105
126
}
106
127
107
- js_set
128
+ result
108
129
}
109
130
110
131
// If there are no outputs, marks all predicates as outputs.
You can’t perform that action at this time.
0 commit comments