@@ -16,7 +16,6 @@ limitations under the License.
1616
1717use std:: collections:: HashMap ;
1818
19- use hyperlight_common:: flatbuffer_wrappers:: function_types:: { ParameterType , ReturnType } ;
2019use hyperlight_common:: flatbuffer_wrappers:: host_function_definition:: HostFunctionDefinition ;
2120use hyperlight_common:: flatbuffer_wrappers:: host_function_details:: HostFunctionDetails ;
2221use hyperlight_host:: func:: { HostFunction , ParameterTuple , Registerable , SupportedReturnType } ;
@@ -52,7 +51,14 @@ impl Registerable for ProtoWasmSandbox {
5251
5352 // Track the host function definition for pushing to guest at load time.
5453 // matching hyperlight-core's FunctionRegistry behavior.
55- self . track_host_function_definition ( name, Args :: TYPE , Output :: TYPE ) ;
54+ self . host_function_definitions . insert (
55+ name. to_string ( ) ,
56+ HostFunctionDefinition {
57+ function_name : name. to_string ( ) ,
58+ parameter_types : Some ( Args :: TYPE . to_vec ( ) ) ,
59+ return_type : Output :: TYPE ,
60+ } ,
61+ ) ;
5662 Ok ( ( ) )
5763 }
5864}
@@ -129,29 +135,7 @@ impl ProtoWasmSandbox {
129135 name : impl AsRef < str > ,
130136 host_func : impl Into < HostFunction < Output , Args > > ,
131137 ) -> Result < ( ) > {
132- self . inner
133- . as_mut ( )
134- . ok_or ( new_error ! ( "inner sandbox was none" ) ) ?
135- . register ( & name, host_func) ?;
136-
137- self . track_host_function_definition ( name. as_ref ( ) , Args :: TYPE , Output :: TYPE ) ;
138- Ok ( ( ) )
139- }
140-
141- fn track_host_function_definition (
142- & mut self ,
143- name : & str ,
144- parameter_types : & [ ParameterType ] ,
145- return_type : ReturnType ,
146- ) {
147- self . host_function_definitions . insert (
148- name. to_string ( ) ,
149- HostFunctionDefinition {
150- function_name : name. to_string ( ) ,
151- parameter_types : Some ( parameter_types. to_vec ( ) ) ,
152- return_type,
153- } ,
154- ) ;
138+ self . register_host_function ( name. as_ref ( ) , host_func)
155139 }
156140
157141 /// Register the given host printing function `print_func` with `self`.
0 commit comments