Skip to content

Commit 80fff4f

Browse files
committed
Update reqwest to 0.12
1 parent 9734146 commit 80fff4f

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ libloading = { version = "0.8", optional = true }
6464
trybuild = "1.0"
6565
futures = "0.3.5"
6666
hyper = { version = "0.14", features = ["client", "server"] }
67-
reqwest = { version = "0.11", features = ["json"] }
67+
reqwest = { version = "0.12", features = ["json"] }
6868
tokio = { version = "1.0", features = ["macros", "rt", "time"] }
6969
serde = { version = "1.0", features = ["derive"] }
7070
serde_json = "1.0"

examples/async_http_reqwest.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
use mlua::{chunk, ExternalResult, Lua, LuaSerdeExt, Result};
1+
use mlua::{chunk, ExternalResult, Lua, LuaSerdeExt, Result, Value};
22

33
#[tokio::main(flavor = "current_thread")]
44
async fn main() -> Result<()> {
55
let lua = Lua::new();
66

7-
let null = lua.null();
8-
97
let fetch_json = lua.create_async_function(|lua, uri: String| async move {
108
let resp = reqwest::get(&uri)
119
.await
@@ -15,19 +13,15 @@ async fn main() -> Result<()> {
1513
lua.to_value(&json)
1614
})?;
1715

16+
let dbg = lua.create_function(|_, value: Value| {
17+
println!("{value:#?}");
18+
Ok(())
19+
})?;
20+
1821
let f = lua
1922
.load(chunk! {
20-
function print_r(t, indent)
21-
local indent = indent or ""
22-
for k, v in pairs(t) do
23-
io.write(indent, tostring(k))
24-
if type(v) == "table" then io.write(":\n") print_r(v, indent.." ")
25-
else io.write(": ", v == $null and "null" or tostring(v), "\n") end
26-
end
27-
end
28-
2923
local res = $fetch_json(...)
30-
print_r(res)
24+
$dbg(res)
3125
})
3226
.into_function()?;
3327

0 commit comments

Comments
 (0)