File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
backend/sys/entities/function Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -384,6 +384,14 @@ impl<T: 'static> AsyncFunctionEnvHandleMut<T> {
384384 let data = unsafe { & mut * data } ;
385385 ( data, & mut self . write_lock )
386386 }
387+
388+ /// Borrows a new [`FunctionEnvMut`] from this [`AsyncFunctionEnvHandleMut`].
389+ pub fn as_function_env_mut ( & mut self ) -> FunctionEnvMut < ' _ , T > {
390+ FunctionEnvMut {
391+ store_mut : self . write_lock . as_store_mut ( ) ,
392+ func_env : self . func_env . clone ( ) ,
393+ }
394+ }
387395}
388396
389397#[ cfg( feature = "experimental-async" ) ]
Original file line number Diff line number Diff line change @@ -393,6 +393,17 @@ impl<T: 'static> BackendAsyncFunctionEnvHandleMut<T> {
393393 _ => unsupported_async_backend :: < ( & mut T , & mut crate :: StoreMut ) > ( ) ,
394394 }
395395 }
396+
397+ /// Borrows a new [`BackendFunctionEnvMut`] from this
398+ /// [`BackendAsyncFunctionEnvHandleMut`].
399+ pub fn as_function_env_mut ( & mut self ) -> BackendFunctionEnvMut < ' _ , T > {
400+ match self {
401+ #[ cfg( feature = "sys" ) ]
402+ Self :: Sys ( f) => BackendFunctionEnvMut :: Sys ( f. as_function_env_mut ( ) ) ,
403+ #[ cfg( not( feature = "sys" ) ) ]
404+ _ => unsupported_async_backend ( ) ,
405+ }
406+ }
396407}
397408
398409#[ cfg( feature = "experimental-async" ) ]
Original file line number Diff line number Diff line change @@ -193,6 +193,12 @@ impl<T: 'static> AsyncFunctionEnvHandleMut<T> {
193193 pub fn data_and_store_mut ( & mut self ) -> ( & mut T , & mut impl AsStoreMut ) {
194194 self . 0 . data_and_store_mut ( )
195195 }
196+
197+ /// Borrows a new [`FunctionEnvMut`] from this
198+ /// [`AsyncFunctionEnvHandleMut`].
199+ pub fn as_function_env_mut ( & mut self ) -> FunctionEnvMut < ' _ , T > {
200+ FunctionEnvMut ( self . 0 . as_function_env_mut ( ) )
201+ }
196202}
197203
198204#[ cfg( feature = "experimental-async" ) ]
You can’t perform that action at this time.
0 commit comments