@@ -10,31 +10,18 @@ use crate::{FunctionBody, Operator, WasmFeatures, WasmModuleResources};
10
10
/// for sending to other threads while the original
11
11
/// [`Validator`](crate::Validator) continues processing other functions.
12
12
pub struct FuncToValidate < T > {
13
- resources : T ,
14
- index : u32 ,
15
- ty : u32 ,
16
- features : WasmFeatures ,
13
+ /// Reusable, heap allocated resources to drive the Wasm validation.
14
+ pub resources : T ,
15
+ /// The core Wasm function index being validated.
16
+ pub index : u32 ,
17
+ /// The core Wasm type index of the function being validated,
18
+ /// defining the results and parameters to the function.
19
+ pub ty : u32 ,
20
+ /// The Wasm features enabled to validate the function.
21
+ pub features : WasmFeatures ,
17
22
}
18
23
19
24
impl < T : WasmModuleResources > FuncToValidate < T > {
20
- /// Creates a new function to validate which will have the specified
21
- /// configuration parameters:
22
- ///
23
- /// * `index` - the core wasm function index being validated
24
- /// * `ty` - the core wasm type index of the function being validated,
25
- /// defining the results and parameters to the function.
26
- /// * `resources` - metadata and type information about the module that
27
- /// this function is validated within.
28
- /// * `features` - enabled WebAssembly features.
29
- pub fn new ( index : u32 , ty : u32 , resources : T , features : & WasmFeatures ) -> FuncToValidate < T > {
30
- FuncToValidate {
31
- resources,
32
- index,
33
- ty,
34
- features : * features,
35
- }
36
- }
37
-
38
25
/// Converts this [`FuncToValidate`] into a [`FuncValidator`] using the
39
26
/// `allocs` provided.
40
27
///
@@ -310,8 +297,13 @@ mod tests {
310
297
311
298
#[ test]
312
299
fn operand_stack_height ( ) {
313
- let mut v = FuncToValidate :: new ( 0 , 0 , EmptyResources :: default ( ) , & Default :: default ( ) )
314
- . into_validator ( Default :: default ( ) ) ;
300
+ let mut v = FuncToValidate {
301
+ index : 0 ,
302
+ ty : 0 ,
303
+ resources : EmptyResources :: default ( ) ,
304
+ features : Default :: default ( ) ,
305
+ }
306
+ . into_validator ( Default :: default ( ) ) ;
315
307
316
308
// Initially zero values on the stack.
317
309
assert_eq ! ( v. operand_stack_height( ) , 0 ) ;
0 commit comments