6 releases (breaking)
0.5.0 | Mar 17, 2022 |
---|---|
0.4.0 | Apr 11, 2020 |
0.3.0 | Apr 4, 2020 |
0.2.0 | Apr 4, 2020 |
0.1.1 | Apr 4, 2020 |
#848 in Asynchronous
29KB
541 lines
rlua-async
rlua-async
provides a way for asynchronous Rust code using rlua
to
seamlessly interface with Lua code, the only condition being that the Lua code
must not make use of coroutines, as it is the way the async
handling is
proxied through Lua.
Make async
builtins available to Lua code
The first thing you need to do is to make async
builtins available to Lua
code. You can do it via eg.
ContextExt::create_async_function
.
Once these builtins are available, they can be called by Lua code. This Lua code
must not use coroutines, as the coroutines are an essential part of how
rlua-async
works internally.
Call Lua code asynchronously
In addition to this, to actually make the code async
, it is also required to
retrieve a Future
when trying to call functions -- otherwise, evaluation is
not going to be asynchronous.
To do that, you can use methods like
FunctionExt::call_async
.
Changelog
See the Changelog for more details.
Dependencies
~1.4–2.1MB
~38K SLoC