Rename to mlua
This commit is contained in:
parent
9e06b10e50
commit
cb109f6e36
12
Cargo.toml
12
Cargo.toml
|
@ -1,22 +1,22 @@
|
|||
[package]
|
||||
name = "rlua"
|
||||
name = "mlua"
|
||||
version = "0.15.3"
|
||||
authors = ["kyren <catherine@chucklefish.org>"]
|
||||
authors = ["Aleksandr Orlenko <zxteam@pm.me>", "kyren <catherine@chucklefish.org>"]
|
||||
edition = "2018"
|
||||
description = "High level bindings to Lua 5.3"
|
||||
repository = "https://github.com/chucklefish/rlua"
|
||||
documentation = "https://docs.rs/rlua"
|
||||
repository = "https://github.com/khvzak/mlua"
|
||||
documentation = "https://docs.rs/mlua"
|
||||
readme = "README.md"
|
||||
keywords = ["lua"]
|
||||
license = "MIT"
|
||||
|
||||
# [badges]
|
||||
# travis-ci = { repository = "chucklefish/rlua", branch = "master" }
|
||||
# travis-ci = { repository = "khvzak/mlua", branch = "master" }
|
||||
|
||||
[dependencies]
|
||||
libc = { version = "0.2" }
|
||||
num-traits = { version = "0.2.6" }
|
||||
bstr = {version = "0.2", features = ["std"], default_features = false }
|
||||
bstr = { version = "0.2", features = ["std"], default_features = false }
|
||||
|
||||
[build-dependencies]
|
||||
cc = { version = "1.0" }
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::result::Result as StdResult;
|
|||
use std::string::String as StdString;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Error type returned by `rlua` methods.
|
||||
/// Error type returned by `mlua` methods.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Error {
|
||||
/// Syntax error while parsing Lua source code.
|
||||
|
@ -44,7 +44,7 @@ pub enum Error {
|
|||
CallbackDestructed,
|
||||
/// Not enough stack space to place arguments to Lua functions or return values from callbacks.
|
||||
///
|
||||
/// Due to the way `rlua` works, it should not be directly possible to run out of stack space
|
||||
/// Due to the way `mlua` works, it should not be directly possible to run out of stack space
|
||||
/// during normal use. The only way that this error can be triggered is if a `Function` is
|
||||
/// called with a huge number of arguments, or a rust callback returns a huge number of return
|
||||
/// values.
|
||||
|
@ -126,7 +126,7 @@ pub enum Error {
|
|||
ExternalError(Arc<dyn StdError + Send + Sync>),
|
||||
}
|
||||
|
||||
/// A specialized `Result` type used by `rlua`'s API.
|
||||
/// A specialized `Result` type used by `mlua`'s API.
|
||||
pub type Result<T> = StdResult<T, Error>;
|
||||
|
||||
impl fmt::Display for Error {
|
||||
|
|
|
@ -23,7 +23,7 @@ impl<'lua> Function<'lua> {
|
|||
/// Call Lua's built-in `tostring` function:
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, Function, Result};
|
||||
/// # use mlua::{Lua, Function, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
/// let globals = lua.globals();
|
||||
|
@ -39,7 +39,7 @@ impl<'lua> Function<'lua> {
|
|||
/// Call a function with multiple arguments:
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, Function, Result};
|
||||
/// # use mlua::{Lua, Function, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
///
|
||||
|
@ -95,7 +95,7 @@ impl<'lua> Function<'lua> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, Function, Result};
|
||||
/// # use mlua::{Lua, Function, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
///
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! # High-level bindings to Lua
|
||||
//!
|
||||
//! The `rlua` crate provides safe high-level bindings to the [Lua programming language].
|
||||
//! The `mlua` crate provides safe high-level bindings to the [Lua programming language].
|
||||
//!
|
||||
//! # The `Lua` object
|
||||
//!
|
||||
|
@ -16,7 +16,7 @@
|
|||
//! For more general conversions, the [`ToLuaMulti`] and [`FromLuaMulti`] traits allow converting
|
||||
//! between Rust types and *any number* of Lua values.
|
||||
//!
|
||||
//! Most code in `rlua` is generic over implementors of those traits, so in most places the normal
|
||||
//! Most code in `mlua` is generic over implementors of those traits, so in most places the normal
|
||||
//! Rust data structures are accepted without having to write any boilerplate.
|
||||
//!
|
||||
//! # Custom Userdata
|
||||
|
|
16
src/lua.rs
16
src/lua.rs
|
@ -39,7 +39,7 @@ impl Lua {
|
|||
let main_state = get_main_state(state);
|
||||
let main_state_top = ffi::lua_gettop(state);
|
||||
|
||||
let ref_thread = rlua_expect!(
|
||||
let ref_thread = mlua_expect!(
|
||||
protect_lua_closure(main_state, 0, 0, |state| {
|
||||
init_error_registry(state);
|
||||
|
||||
|
@ -84,7 +84,7 @@ impl Lua {
|
|||
ref_free: Vec::new(),
|
||||
}));
|
||||
|
||||
rlua_debug_assert!(
|
||||
mlua_debug_assert!(
|
||||
ffi::lua_gettop(main_state) == main_state_top,
|
||||
"stack leak during creation"
|
||||
);
|
||||
|
@ -314,7 +314,7 @@ impl Lua {
|
|||
/// Create a function which prints its argument:
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, Result};
|
||||
/// # use mlua::{Lua, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
///
|
||||
|
@ -330,7 +330,7 @@ impl Lua {
|
|||
/// Use tuples to accept multiple arguments:
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, Result};
|
||||
/// # use mlua::{Lua, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
///
|
||||
|
@ -705,13 +705,13 @@ impl Lua {
|
|||
pub fn expire_registry_values(&self) {
|
||||
unsafe {
|
||||
let unref_list = mem::replace(
|
||||
&mut *rlua_expect!(
|
||||
&mut *mlua_expect!(
|
||||
(*extra_data(self.main_state)).registry_unref_list.lock(),
|
||||
"unref list poisoned"
|
||||
),
|
||||
Some(Vec::new()),
|
||||
);
|
||||
for id in rlua_expect!(unref_list, "unref list not set") {
|
||||
for id in mlua_expect!(unref_list, "unref list not set") {
|
||||
ffi::luaL_unref(self.state, ffi::LUA_REGISTRYINDEX, id);
|
||||
}
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ impl Lua {
|
|||
|
||||
ffi::LUA_TTHREAD => Value::Thread(Thread(self.pop_ref())),
|
||||
|
||||
_ => rlua_panic!("LUA_TNONE in pop_value"),
|
||||
_ => mlua_panic!("LUA_TNONE in pop_value"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1124,7 +1124,7 @@ unsafe fn ref_stack_pop(extra: *mut ExtraData) -> c_int {
|
|||
// It is a user error to create enough references to exhaust the Lua max stack size for
|
||||
// the ref thread.
|
||||
if ffi::lua_checkstack((*extra).ref_thread, (*extra).ref_stack_size) == 0 {
|
||||
rlua_panic!("cannot create a Lua reference, out of auxiliary stack space");
|
||||
mlua_panic!("cannot create a Lua reference, out of auxiliary stack space");
|
||||
}
|
||||
(*extra).ref_stack_size *= 2;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
macro_rules! bug_msg {
|
||||
($arg:expr) => {
|
||||
concat!(
|
||||
"rlua internal error: ",
|
||||
"mlua internal error: ",
|
||||
$arg,
|
||||
" (this is a bug, please file an issue)"
|
||||
)
|
||||
|
@ -15,13 +15,13 @@ macro_rules! cstr {
|
|||
};
|
||||
}
|
||||
|
||||
macro_rules! rlua_panic {
|
||||
macro_rules! mlua_panic {
|
||||
($msg:expr) => {
|
||||
panic!(bug_msg!($msg));
|
||||
};
|
||||
|
||||
($msg:expr,) => {
|
||||
rlua_panic!($msg);
|
||||
mlua_panic!($msg);
|
||||
};
|
||||
|
||||
($msg:expr, $($arg:expr),+) => {
|
||||
|
@ -29,17 +29,17 @@ macro_rules! rlua_panic {
|
|||
};
|
||||
|
||||
($msg:expr, $($arg:expr),+,) => {
|
||||
rlua_panic!($msg, $($arg),+);
|
||||
mlua_panic!($msg, $($arg),+);
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! rlua_assert {
|
||||
macro_rules! mlua_assert {
|
||||
($cond:expr, $msg:expr) => {
|
||||
assert!($cond, bug_msg!($msg));
|
||||
};
|
||||
|
||||
($cond:expr, $msg:expr,) => {
|
||||
rlua_assert!($cond, $msg);
|
||||
mlua_assert!($cond, $msg);
|
||||
};
|
||||
|
||||
($cond:expr, $msg:expr, $($arg:expr),+) => {
|
||||
|
@ -47,17 +47,17 @@ macro_rules! rlua_assert {
|
|||
};
|
||||
|
||||
($cond:expr, $msg:expr, $($arg:expr),+,) => {
|
||||
rlua_assert!($cond, $msg, $($arg),+);
|
||||
mlua_assert!($cond, $msg, $($arg),+);
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! rlua_debug_assert {
|
||||
macro_rules! mlua_debug_assert {
|
||||
($cond:expr, $msg:expr) => {
|
||||
debug_assert!($cond, bug_msg!($msg));
|
||||
};
|
||||
|
||||
($cond:expr, $msg:expr,) => {
|
||||
rlua_debug_assert!($cond, $msg);
|
||||
mlua_debug_assert!($cond, $msg);
|
||||
};
|
||||
|
||||
($cond:expr, $msg:expr, $($arg:expr),+) => {
|
||||
|
@ -65,16 +65,16 @@ macro_rules! rlua_debug_assert {
|
|||
};
|
||||
|
||||
($cond:expr, $msg:expr, $($arg:expr),+,) => {
|
||||
rlua_debug_assert!($cond, $msg, $($arg),+);
|
||||
mlua_debug_assert!($cond, $msg, $($arg),+);
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! rlua_expect {
|
||||
macro_rules! mlua_expect {
|
||||
($res:expr, $msg:expr) => {
|
||||
$res.expect(bug_msg!($msg))
|
||||
};
|
||||
|
||||
($res:expr, $msg:expr,) => {
|
||||
rlua_expect!($res, $msg)
|
||||
mlua_expect!($res, $msg)
|
||||
};
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ impl<'lua> FromLuaMulti<'lua> for MultiValue<'lua> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, Variadic, Result};
|
||||
/// # use mlua::{Lua, Variadic, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
/// let add = lua.create_function(|_, vals: Variadic<f64>| -> Result<f64> {
|
||||
|
|
|
@ -17,7 +17,7 @@ impl<'lua> String<'lua> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, String, Result};
|
||||
/// # use mlua::{Lua, String, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
/// let globals = lua.globals();
|
||||
|
@ -46,7 +46,7 @@ impl<'lua> String<'lua> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, String, Result};
|
||||
/// # use mlua::{Lua, String, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
/// let non_utf8: String = lua.load(r#" "test\xff" "#).eval()?;
|
||||
|
@ -68,7 +68,7 @@ impl<'lua> String<'lua> {
|
|||
assert_stack(lua.state, 1);
|
||||
|
||||
lua.push_ref(&self.0);
|
||||
rlua_debug_assert!(
|
||||
mlua_debug_assert!(
|
||||
ffi::lua_type(lua.state, -1) == ffi::LUA_TSTRING,
|
||||
"string ref is not string type"
|
||||
);
|
||||
|
@ -91,7 +91,7 @@ impl<'lua> AsRef<[u8]> for String<'lua> {
|
|||
|
||||
// Lua strings are basically &[u8] slices, so implement PartialEq for anything resembling that.
|
||||
//
|
||||
// This makes our `String` comparable with `Vec<u8>`, `[u8]`, `&str`, `String` and `rlua::String`
|
||||
// This makes our `String` comparable with `Vec<u8>`, `[u8]`, `&str`, `String` and `mlua::String`
|
||||
// itself.
|
||||
//
|
||||
// The only downside is that this disallows a comparison with `Cow<str>`, as that only implements
|
||||
|
|
10
src/table.rs
10
src/table.rs
|
@ -25,7 +25,7 @@ impl<'lua> Table<'lua> {
|
|||
/// Export a value as a global to make it usable from Lua:
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, Result};
|
||||
/// # use mlua::{Lua, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
/// let globals = lua.globals();
|
||||
|
@ -78,7 +78,7 @@ impl<'lua> Table<'lua> {
|
|||
/// Query the version of the Lua interpreter:
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, Result};
|
||||
/// # use mlua::{Lua, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
/// let globals = lua.globals();
|
||||
|
@ -141,7 +141,7 @@ impl<'lua> Table<'lua> {
|
|||
/// Execute the table method with name "concat":
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Function, Lua, Result};
|
||||
/// # use mlua::{Function, Lua, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// # let lua = Lua::new();
|
||||
/// # let table = lua.create_table();
|
||||
|
@ -292,7 +292,7 @@ impl<'lua> Table<'lua> {
|
|||
/// Iterate over all globals:
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, Result, Value};
|
||||
/// # use mlua::{Lua, Result, Value};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
/// let globals = lua.globals();
|
||||
|
@ -334,7 +334,7 @@ impl<'lua> Table<'lua> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, Result, Table};
|
||||
/// # use mlua::{Lua, Result, Table};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
/// let my_table: Table = lua.load(r#"
|
||||
|
|
|
@ -46,7 +46,7 @@ impl<'lua> Thread<'lua> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, Thread, Error};
|
||||
/// # use mlua::{Lua, Thread, Error};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// let lua = Lua::new();
|
||||
/// let thread: Thread = lua.eval(r#"
|
||||
|
|
|
@ -52,7 +52,7 @@ impl fmt::Debug for RegistryKey {
|
|||
|
||||
impl Drop for RegistryKey {
|
||||
fn drop(&mut self) {
|
||||
if let Some(list) = rlua_expect!(self.unref_list.lock(), "unref_list poisoned").as_mut() {
|
||||
if let Some(list) = mlua_expect!(self.unref_list.lock(), "unref_list poisoned").as_mut() {
|
||||
list.push(self.registry_id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ pub trait UserDataMethods<'lua, T: UserData> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, UserData, Result};
|
||||
/// # use mlua::{Lua, UserData, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// struct MyUserData(i32);
|
||||
///
|
||||
|
@ -232,7 +232,7 @@ pub trait UserDataMethods<'lua, T: UserData> {
|
|||
/// [`UserDataMethods`] for more information):
|
||||
///
|
||||
/// ```
|
||||
/// # use rlua::{Lua, MetaMethod, UserData, UserDataMethods, Result};
|
||||
/// # use mlua::{Lua, MetaMethod, UserData, UserDataMethods, Result};
|
||||
/// # fn main() -> Result<()> {
|
||||
/// struct MyUserData(i32);
|
||||
///
|
||||
|
|
22
src/util.rs
22
src/util.rs
|
@ -12,10 +12,10 @@ use crate::ffi;
|
|||
// Checks that Lua has enough free stack space for future stack operations. On failure, this will
|
||||
// panic with an internal error message.
|
||||
pub unsafe fn assert_stack(state: *mut ffi::lua_State, amount: c_int) {
|
||||
// TODO: This should only be triggered when there is a logic error in `rlua`. In the future,
|
||||
// TODO: This should only be triggered when there is a logic error in `mlua`. In the future,
|
||||
// when there is a way to be confident about stack safety and test it, this could be enabled
|
||||
// only when `cfg!(debug_assertions)` is true.
|
||||
rlua_assert!(
|
||||
mlua_assert!(
|
||||
ffi::lua_checkstack(state, amount) != 0,
|
||||
"out of stack space"
|
||||
);
|
||||
|
@ -54,7 +54,7 @@ impl Drop for StackGuard {
|
|||
if top > self.top {
|
||||
ffi::lua_settop(self.state, self.top);
|
||||
} else if top < self.top {
|
||||
rlua_panic!("{} too many stack values popped", self.top - top);
|
||||
mlua_panic!("{} too many stack values popped", self.top - top);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ where
|
|||
// 3) Otherwise, interprets the error as the appropriate lua error.
|
||||
// Uses 2 stack spaces, does not call lua_checkstack.
|
||||
pub unsafe fn pop_error(state: *mut ffi::lua_State, err_code: c_int) -> Error {
|
||||
rlua_debug_assert!(
|
||||
mlua_debug_assert!(
|
||||
err_code != ffi::LUA_OK && err_code != ffi::LUA_YIELD,
|
||||
"pop_error called with non-error return code"
|
||||
);
|
||||
|
@ -180,7 +180,7 @@ pub unsafe fn pop_error(state: *mut ffi::lua_State, err_code: c_int) -> Error {
|
|||
if let Some(p) = (*panic).0.take() {
|
||||
resume_unwind(p);
|
||||
} else {
|
||||
rlua_panic!("error during panic handling, panic was resumed twice")
|
||||
mlua_panic!("error during panic handling, panic was resumed twice")
|
||||
}
|
||||
} else {
|
||||
let err_string = to_string(state, -1).into_owned();
|
||||
|
@ -205,7 +205,7 @@ pub unsafe fn pop_error(state: *mut ffi::lua_State, err_code: c_int) -> Error {
|
|||
}
|
||||
ffi::LUA_ERRMEM => Error::MemoryError(err_string),
|
||||
ffi::LUA_ERRGCMM => Error::GarbageCollectorError(err_string),
|
||||
_ => rlua_panic!("unrecognized lua error code"),
|
||||
_ => mlua_panic!("unrecognized lua error code"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ pub unsafe fn push_userdata<T>(state: *mut ffi::lua_State, t: T) -> Result<()> {
|
|||
|
||||
pub unsafe fn get_userdata<T>(state: *mut ffi::lua_State, index: c_int) -> *mut T {
|
||||
let ud = ffi::lua_touserdata(state, index) as *mut T;
|
||||
rlua_debug_assert!(!ud.is_null(), "userdata pointer is null");
|
||||
mlua_debug_assert!(!ud.is_null(), "userdata pointer is null");
|
||||
ud
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ pub unsafe fn take_userdata<T>(state: *mut ffi::lua_State) -> T {
|
|||
get_destructed_userdata_metatable(state);
|
||||
ffi::lua_setmetatable(state, -2);
|
||||
let ud = ffi::lua_touserdata(state, -1) as *mut T;
|
||||
rlua_debug_assert!(!ud.is_null(), "userdata pointer is null");
|
||||
mlua_debug_assert!(!ud.is_null(), "userdata pointer is null");
|
||||
ffi::lua_pop(state, 1);
|
||||
ptr::read(ud)
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ pub unsafe fn init_userdata_metatable<T>(
|
|||
ffi::lua_pushcclosure(state, meta_index_impl, 2);
|
||||
})?;
|
||||
} else {
|
||||
rlua_panic!("improper __index type {}", index_type);
|
||||
mlua_panic!("improper __index type {}", index_type);
|
||||
}
|
||||
|
||||
protect_lua_closure(state, 3, 1, |state| {
|
||||
|
@ -531,10 +531,10 @@ pub unsafe fn init_error_registry(state: *mut ffi::lua_State) {
|
|||
let _ = write!(&mut (*err_buf), "{}", error);
|
||||
Ok(err_buf)
|
||||
} else {
|
||||
rlua_panic!("error during panic handling, panic was resumed twice")
|
||||
mlua_panic!("error during panic handling, panic was resumed twice")
|
||||
}
|
||||
} else {
|
||||
// I'm not sure whether this is possible to trigger without bugs in rlua?
|
||||
// I'm not sure whether this is possible to trigger without bugs in mlua?
|
||||
Err(Error::UserDataTypeMismatch)
|
||||
}
|
||||
});
|
||||
|
|
|
@ -27,7 +27,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn make_lua() -> rlua::Lua {
|
||||
fn make_lua() -> mlua::Lua {
|
||||
macro_rules! cstr {
|
||||
($s:expr) => {
|
||||
concat!($s, "\0") as *const str as *const ::std::os::raw::c_char
|
||||
|
@ -48,6 +48,6 @@ fn make_lua() -> rlua::Lua {
|
|||
luaL_requiref(state, cstr!("package"), luaopen_package, 1);
|
||||
lua_settop(state, -8 - 1);
|
||||
|
||||
rlua::Lua::init_from_ptr(state)
|
||||
mlua::Lua::init_from_ptr(state)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use bstr::{BStr, BString};
|
||||
use rlua::Result;
|
||||
use mlua::Result;
|
||||
|
||||
include!("_lua.rs");
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use rlua::{Function, Result, String};
|
||||
use mlua::{Function, Result, String};
|
||||
|
||||
include!("_lua.rs");
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use rlua::{Error, Result, UserData};
|
||||
use mlua::{Error, Result, UserData};
|
||||
|
||||
include!("_lua.rs");
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::cell::Cell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use rlua::{Error, Function, MetaMethod, Result, String, UserData, UserDataMethods};
|
||||
use mlua::{Error, Function, MetaMethod, Result, String, UserData, UserDataMethods};
|
||||
|
||||
include!("_lua.rs");
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use rlua::{Result, String};
|
||||
use mlua::{Result, String};
|
||||
|
||||
include!("_lua.rs");
|
||||
|
||||
|
@ -15,7 +15,7 @@ fn compare() {
|
|||
with_str("teststring", |t| assert_eq!(t, b"teststring")); // &[u8]
|
||||
with_str("teststring", |t| assert_eq!(t, b"teststring".to_vec())); // Vec<u8>
|
||||
with_str("teststring", |t| assert_eq!(t, "teststring".to_string())); // String
|
||||
with_str("teststring", |t| assert_eq!(t, t)); // rlua::String
|
||||
with_str("teststring", |t| assert_eq!(t, t)); // mlua::String
|
||||
with_str("teststring", |t| {
|
||||
assert_eq!(t, Cow::from(b"teststring".as_ref()))
|
||||
}); // Cow (borrowed)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use rlua::{Nil, Result, Table, Value};
|
||||
use mlua::{Nil, Result, Table, Value};
|
||||
|
||||
include!("_lua.rs");
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::panic::catch_unwind;
|
|||
use std::sync::Arc;
|
||||
use std::{error, f32, f64, fmt};
|
||||
|
||||
use rlua::{Error, ExternalError, Function, Nil, Result, String, Table, UserData, Value, Variadic};
|
||||
use mlua::{Error, ExternalError, Function, Nil, Result, String, Table, UserData, Value, Variadic};
|
||||
|
||||
include!("_lua.rs");
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::panic::catch_unwind;
|
||||
|
||||
use rlua::{Error, Function, Result, Thread, ThreadStatus};
|
||||
use mlua::{Error, Function, Result, Thread, ThreadStatus};
|
||||
|
||||
include!("_lua.rs");
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::os::raw::c_void;
|
||||
|
||||
use rlua::{Function, LightUserData, Result};
|
||||
use mlua::{Function, LightUserData, Result};
|
||||
|
||||
include!("_lua.rs");
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use rlua::{
|
||||
use mlua::{
|
||||
AnyUserData, ExternalError, Function, MetaMethod, Result, String, UserData, UserDataMethods,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue