summaryrefslogtreecommitdiff
path: root/tests/async.rs
diff options
context:
space:
mode:
authorAlex Orlenko <zxteam@protonmail.com>2022-05-15 01:15:31 +0100
committerAlex Orlenko <zxteam@protonmail.com>2022-05-15 01:15:31 +0100
commit2a8c5c7f82e1b8cc2f9c0ef572756e5c16ae90b1 (patch)
tree104b64b6815ad91753678bb0d725c6cf84678a79 /tests/async.rs
parent6b2ceb60c42f540a652b53861a8d6df1121a43d8 (diff)
downloadmlua-2a8c5c7f82e1b8cc2f9c0ef572756e5c16ae90b1.zip
Refactor `Function::bind` implementation.
Make it possible to bind async function arguments. Fixes #161
Diffstat (limited to 'tests/async.rs')
-rw-r--r--tests/async.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/async.rs b/tests/async.rs
index 9200da6..fcfb9c7 100644
--- a/tests/async.rs
+++ b/tests/async.rs
@@ -75,7 +75,10 @@ async fn test_async_call() -> Result<()> {
async fn test_async_bind_call() -> Result<()> {
let lua = Lua::new();
- let sum = lua.create_async_function(|_lua, (a, b): (i64, i64)| async move { Ok(a + b) })?;
+ let sum = lua.create_async_function(|_lua, (a, b): (i64, i64)| async move {
+ tokio::task::yield_now().await;
+ Ok(a + b)
+ })?;
let plus_10 = sum.bind(10)?;
lua.globals().set("plus_10", plus_10)?;