From f7dc9da107e99a23ad4f696cccfaa384a4da3f20 Mon Sep 17 00:00:00 2001 From: Alex Orlenko Date: Fri, 17 Apr 2020 22:43:50 +0100 Subject: [PATCH] Update README Cargo fmt and minor changes --- README.md | 2 +- build/main.rs | 4 ---- examples/async_http_client.rs | 7 +++++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7f5f946..00db39b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ modules in Rust. ### Async -Starting from 0.3, mlua supports async/await for all Lua versions. This feature works using Lua [coroutines](https://www.lua.org/manual/5.3/manual.html#2.6) and require running [Thread](https://docs.rs/mlua/latest/mlua/struct.Thread.html). +Starting from 0.3, mlua supports async/await for all Lua versions. This works using Lua [coroutines](https://www.lua.org/manual/5.3/manual.html#2.6) and require running [Thread](https://docs.rs/mlua/latest/mlua/struct.Thread.html) along with enabling `async` feature in `Cargo.toml`. **Examples**: - [HTTP Client](examples/async_http_client.rs) diff --git a/build/main.rs b/build/main.rs index 1f54100..b43d0ed 100644 --- a/build/main.rs +++ b/build/main.rs @@ -81,10 +81,6 @@ fn main() { #[cfg(all(feature = "lua51", feature = "luajit"))] panic!("You can enable only one of the features: lua53, lua52, lua51, luajit"); - // Async - // #[cfg(all(feature = "async", not(any(feature = "lua53", feature = "lua52"))))] - // panic!("You can enable async only for: lua53, lua52"); - let include_dir = find::probe_lua(); build_glue(&include_dir); } diff --git a/examples/async_http_client.rs b/examples/async_http_client.rs index 3321515..fd8ffb0 100644 --- a/examples/async_http_client.rs +++ b/examples/async_http_client.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use hyper::Client as HyperClient; -use mlua::{Lua, Result, Thread, Error}; +use mlua::{Error, Lua, Result, Thread}; #[tokio::main] async fn main() -> Result<()> { @@ -18,7 +18,10 @@ async fn main() -> Result<()> { let mut headers = HashMap::new(); for (key, value) in resp.headers().iter() { - headers.entry(key.as_str()).or_insert(Vec::new()).push(value.to_str().unwrap()); + headers + .entry(key.as_str()) + .or_insert(Vec::new()) + .push(value.to_str().unwrap()); } lua_resp.set("headers", headers)?;