@@ -13,10 +13,7 @@ use crate::util::{assert_stack, check_stack, get_metatable_ptr, StackGuard};
1313use crate :: value:: { Nil , Value } ;
1414
1515#[ cfg( feature = "async" ) ]
16- use {
17- crate :: types:: MaybeSend ,
18- futures_util:: future:: { self , Either , Future } ,
19- } ;
16+ use crate :: function:: AsyncCallFuture ;
2017
2118#[ cfg( feature = "serde" ) ]
2219use {
@@ -892,9 +889,9 @@ impl ObjectLike for Table {
892889
893890 #[ cfg( feature = "async" ) ]
894891 #[ inline]
895- fn call_async < R > ( & self , args : impl IntoLuaMulti ) -> impl Future < Output = Result < R > > + MaybeSend
892+ fn call_async < R > ( & self , args : impl IntoLuaMulti ) -> AsyncCallFuture < R >
896893 where
897- R : FromLuaMulti + MaybeSend ,
894+ R : FromLuaMulti ,
898895 {
899896 Function ( self . 0 . copy ( ) ) . call_async ( args)
900897 }
@@ -908,13 +905,9 @@ impl ObjectLike for Table {
908905 }
909906
910907 #[ cfg( feature = "async" ) ]
911- fn call_async_method < R > (
912- & self ,
913- name : & str ,
914- args : impl IntoLuaMulti ,
915- ) -> impl Future < Output = Result < R > > + MaybeSend
908+ fn call_async_method < R > ( & self , name : & str , args : impl IntoLuaMulti ) -> AsyncCallFuture < R >
916909 where
917- R : FromLuaMulti + MaybeSend ,
910+ R : FromLuaMulti ,
918911 {
919912 self . call_async_function ( name, ( self , args) )
920913 }
@@ -932,21 +925,17 @@ impl ObjectLike for Table {
932925
933926 #[ cfg( feature = "async" ) ]
934927 #[ inline]
935- fn call_async_function < R > (
936- & self ,
937- name : & str ,
938- args : impl IntoLuaMulti ,
939- ) -> impl Future < Output = Result < R > > + MaybeSend
928+ fn call_async_function < R > ( & self , name : & str , args : impl IntoLuaMulti ) -> AsyncCallFuture < R >
940929 where
941- R : FromLuaMulti + MaybeSend ,
930+ R : FromLuaMulti ,
942931 {
943932 match self . get ( name) {
944- Ok ( Value :: Function ( func) ) => Either :: Left ( func. call_async ( args) ) ,
933+ Ok ( Value :: Function ( func) ) => func. call_async ( args) ,
945934 Ok ( val) => {
946935 let msg = format ! ( "attempt to call a {} value (function '{name}')" , val. type_name( ) ) ;
947- Either :: Right ( future :: ready ( Err ( Error :: RuntimeError ( msg) ) ) )
936+ AsyncCallFuture :: error ( Error :: RuntimeError ( msg) )
948937 }
949- Err ( err) => Either :: Right ( future :: ready ( Err ( err) ) ) ,
938+ Err ( err) => AsyncCallFuture :: error ( err) ,
950939 }
951940 }
952941
0 commit comments