Breakdown features to smaller crates
This commit is contained in:
parent
cabdff27bf
commit
194f9c6bcc
12
Cargo.toml
12
Cargo.toml
|
@ -26,17 +26,19 @@ members = [
|
|||
|
||||
[features]
|
||||
default = ["lua53"]
|
||||
lua53 = []
|
||||
lua52 = []
|
||||
lua53 = ["futures-task", "futures-util"]
|
||||
lua52 = ["futures-task", "futures-util"]
|
||||
lua51 = []
|
||||
luajit = []
|
||||
vendored = ["lua-src", "luajit-src"]
|
||||
|
||||
[dependencies]
|
||||
num-traits = { version = "0.2.11" }
|
||||
bstr = { version = "0.2", features = ["std"], default_features = false }
|
||||
futures = { version = "0.3.4" }
|
||||
futures-core = { version = "0.3.4" }
|
||||
futures-task = { version = "0.3.4", optional = true }
|
||||
futures-util = { version = "0.3.4", optional = true }
|
||||
lazy_static = { version = "1.4" }
|
||||
num-traits = { version = "0.2.11" }
|
||||
|
||||
[build-dependencies]
|
||||
cc = { version = "1.0" }
|
||||
|
@ -48,6 +50,8 @@ luajit-src = { version = "210.0.0", optional = true }
|
|||
rustyline = "6.0"
|
||||
criterion = "0.3"
|
||||
trybuild = "1.0"
|
||||
futures-executor = "0.3.4"
|
||||
futures-util = "0.3.4"
|
||||
futures-timer = "3.0"
|
||||
|
||||
[[bench]]
|
||||
|
|
18
src/lua.rs
18
src/lua.rs
|
@ -6,11 +6,16 @@ use std::marker::PhantomData;
|
|||
use std::os::raw::{c_char, c_int};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::{mem, ptr, str};
|
||||
use std::task::Waker;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use futures::{
|
||||
future::{self, BoxFuture, Future, FutureExt, TryFutureExt},
|
||||
task::{Context, Poll, Waker},
|
||||
use futures_core::future::BoxFuture;
|
||||
|
||||
#[cfg(any(feature = "lua53", feature = "lua52"))]
|
||||
use {
|
||||
futures_task::noop_waker,
|
||||
futures_util::future::{self, FutureExt, TryFutureExt},
|
||||
std::future::Future,
|
||||
std::task::{Context, Poll},
|
||||
};
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
|
@ -492,7 +497,8 @@ impl Lua {
|
|||
///
|
||||
/// ```
|
||||
/// use std::time::Duration;
|
||||
/// use futures::{executor::block_on, pin_mut, stream::TryStreamExt};
|
||||
/// use futures_executor::block_on;
|
||||
/// use futures_util::{pin_mut, stream::TryStreamExt};
|
||||
/// use futures_timer::Delay;
|
||||
/// # use mlua::{Error, Lua, Result, Thread};
|
||||
///
|
||||
|
@ -1209,7 +1215,7 @@ impl Lua {
|
|||
_no_ref_unwind_safe: PhantomData,
|
||||
};
|
||||
|
||||
let mut waker = futures::task::noop_waker();
|
||||
let mut waker = noop_waker();
|
||||
|
||||
// Try to get an outer poll waker
|
||||
ffi::lua_pushlightuserdata(
|
||||
|
|
|
@ -2,9 +2,9 @@ use std::cell::RefCell;
|
|||
use std::marker::PhantomData;
|
||||
use std::os::raw::{c_int, c_void};
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
use futures::stream::Stream;
|
||||
use futures::task::{Context, Poll};
|
||||
use futures_core::stream::Stream;
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
use crate::ffi;
|
||||
|
@ -169,8 +169,8 @@ impl Thread {
|
|||
///
|
||||
/// ```
|
||||
/// # use mlua::{Error, Lua, Result, Thread};
|
||||
/// use futures::executor::block_on;
|
||||
/// use futures::stream::TryStreamExt;
|
||||
/// use futures_executor::block_on;
|
||||
/// use futures_util::stream::TryStreamExt;
|
||||
/// # fn main() -> Result<()> {
|
||||
/// # let lua = Lua::new();
|
||||
/// let thread: Thread = lua.load(r#"
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::os::raw::{c_int, c_void};
|
|||
use std::sync::{Arc, Mutex};
|
||||
use std::{fmt, mem, ptr};
|
||||
|
||||
use futures::future::BoxFuture;
|
||||
use futures_core::future::BoxFuture;
|
||||
|
||||
use crate::error::Result;
|
||||
use crate::ffi;
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
use std::{string::String as StdString, time::Duration};
|
||||
|
||||
use futures::{executor::block_on, pin_mut, stream::TryStreamExt};
|
||||
use futures_executor::block_on;
|
||||
use futures_util::{pin_mut, stream::TryStreamExt};
|
||||
|
||||
use mlua::{Error, Function, Lua, Result, String, Thread};
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@ use std::panic::catch_unwind;
|
|||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use futures::{executor::block_on, pin_mut, stream::TryStreamExt};
|
||||
use futures_executor::block_on;
|
||||
use futures_util::{pin_mut, stream::TryStreamExt};
|
||||
|
||||
use mlua::{Error, Function, Lua, Result, Thread, ThreadStatus};
|
||||
|
||||
|
|
Loading…
Reference in a new issue