@@ -10,31 +10,18 @@ use crate::{FunctionBody, Operator, WasmFeatures, WasmModuleResources};
1010/// for sending to other threads while the original
1111/// [`Validator`](crate::Validator) continues processing other functions.
1212pub 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 ,
1722}
1823
1924impl < 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-
3825 /// Converts this [`FuncToValidate`] into a [`FuncValidator`] using the
3926 /// `allocs` provided.
4027 ///
@@ -310,8 +297,13 @@ mod tests {
310297
311298 #[ test]
312299 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 ( ) ) ;
315307
316308 // Initially zero values on the stack.
317309 assert_eq ! ( v. operand_stack_height( ) , 0 ) ;
0 commit comments