@@ -13,10 +13,7 @@ use crate::util::{assert_stack, check_stack, get_metatable_ptr, StackGuard};
13
13
use crate :: value:: { Nil , Value } ;
14
14
15
15
#[ cfg( feature = "async" ) ]
16
- use {
17
- crate :: types:: MaybeSend ,
18
- futures_util:: future:: { self , Either , Future } ,
19
- } ;
16
+ use crate :: function:: AsyncCallFuture ;
20
17
21
18
#[ cfg( feature = "serde" ) ]
22
19
use {
@@ -892,9 +889,9 @@ impl ObjectLike for Table {
892
889
893
890
#[ cfg( feature = "async" ) ]
894
891
#[ 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 >
896
893
where
897
- R : FromLuaMulti + MaybeSend ,
894
+ R : FromLuaMulti ,
898
895
{
899
896
Function ( self . 0 . copy ( ) ) . call_async ( args)
900
897
}
@@ -908,13 +905,9 @@ impl ObjectLike for Table {
908
905
}
909
906
910
907
#[ 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 >
916
909
where
917
- R : FromLuaMulti + MaybeSend ,
910
+ R : FromLuaMulti ,
918
911
{
919
912
self . call_async_function ( name, ( self , args) )
920
913
}
@@ -932,21 +925,17 @@ impl ObjectLike for Table {
932
925
933
926
#[ cfg( feature = "async" ) ]
934
927
#[ 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 >
940
929
where
941
- R : FromLuaMulti + MaybeSend ,
930
+ R : FromLuaMulti ,
942
931
{
943
932
match self . get ( name) {
944
- Ok ( Value :: Function ( func) ) => Either :: Left ( func. call_async ( args) ) ,
933
+ Ok ( Value :: Function ( func) ) => func. call_async ( args) ,
945
934
Ok ( val) => {
946
935
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) )
948
937
}
949
- Err ( err) => Either :: Right ( future :: ready ( Err ( err) ) ) ,
938
+ Err ( err) => AsyncCallFuture :: error ( err) ,
950
939
}
951
940
}
952
941
0 commit comments