diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2020-05-06 13:18:04 +0100 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2020-05-11 02:43:34 +0100 |
commit | 2bd5c2f6ca6c7b87b17a7e035096a4d93160836d (patch) | |
tree | d81c2cd8a8e17147d070e7f51bfe9baec8dfc955 /src/userdata.rs | |
parent | 7b0e4b4280b283271429c4f7315d6241d07418d1 (diff) | |
download | mlua-2bd5c2f6ca6c7b87b17a7e035096a4d93160836d.zip |
Hide Lua "Send" capability under the optional "send" feature flag
Diffstat (limited to 'src/userdata.rs')
-rw-r--r-- | src/userdata.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/userdata.rs b/src/userdata.rs index a18ece9..973dfc0 100644 --- a/src/userdata.rs +++ b/src/userdata.rs @@ -8,7 +8,7 @@ use crate::ffi; use crate::function::Function; use crate::lua::Lua; use crate::table::Table; -use crate::types::LuaRef; +use crate::types::{LuaRef, MaybeSend}; use crate::util::{assert_stack, get_userdata, StackGuard}; use crate::value::{FromLua, FromLuaMulti, ToLua, ToLuaMulti}; @@ -137,7 +137,7 @@ pub trait UserDataMethods<'lua, T: UserData> { S: ?Sized + AsRef<[u8]>, A: FromLuaMulti<'lua>, R: ToLuaMulti<'lua>, - M: 'static + Send + Fn(&'lua Lua, &T, A) -> Result<R>; + M: 'static + MaybeSend + Fn(&'lua Lua, &T, A) -> Result<R>; /// Add a regular method which accepts a `&mut T` as the first parameter. /// @@ -149,7 +149,7 @@ pub trait UserDataMethods<'lua, T: UserData> { S: ?Sized + AsRef<[u8]>, A: FromLuaMulti<'lua>, R: ToLuaMulti<'lua>, - M: 'static + Send + FnMut(&'lua Lua, &mut T, A) -> Result<R>; + M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> Result<R>; /// Add an async method which accepts a `T` as the first parameter and returns Future. /// The passed `T` is cloned from the original value. @@ -164,7 +164,7 @@ pub trait UserDataMethods<'lua, T: UserData> { S: ?Sized + AsRef<[u8]>, A: FromLuaMulti<'lua>, R: ToLuaMulti<'lua>, - M: 'static + Send + Fn(&'lua Lua, T, A) -> MR, + M: 'static + MaybeSend + Fn(&'lua Lua, T, A) -> MR, MR: 'lua + Future<Output = Result<R>>; /// Add a regular method as a function which accepts generic arguments, the first argument will @@ -181,7 +181,7 @@ pub trait UserDataMethods<'lua, T: UserData> { S: ?Sized + AsRef<[u8]>, A: FromLuaMulti<'lua>, R: ToLuaMulti<'lua>, - F: 'static + Send + Fn(&'lua Lua, A) -> Result<R>; + F: 'static + MaybeSend + Fn(&'lua Lua, A) -> Result<R>; /// Add a regular method as a mutable function which accepts generic arguments. /// @@ -193,7 +193,7 @@ pub trait UserDataMethods<'lua, T: UserData> { S: ?Sized + AsRef<[u8]>, A: FromLuaMulti<'lua>, R: ToLuaMulti<'lua>, - F: 'static + Send + FnMut(&'lua Lua, A) -> Result<R>; + F: 'static + MaybeSend + FnMut(&'lua Lua, A) -> Result<R>; /// Add a regular method as an async function which accepts generic arguments /// and returns Future. @@ -208,7 +208,7 @@ pub trait UserDataMethods<'lua, T: UserData> { S: ?Sized + AsRef<[u8]>, A: FromLuaMulti<'lua>, R: ToLuaMulti<'lua>, - F: 'static + Send + Fn(&'lua Lua, A) -> FR, + F: 'static + MaybeSend + Fn(&'lua Lua, A) -> FR, FR: 'lua + Future<Output = Result<R>>; /// Add a metamethod which accepts a `&T` as the first parameter. @@ -223,7 +223,7 @@ pub trait UserDataMethods<'lua, T: UserData> { where A: FromLuaMulti<'lua>, R: ToLuaMulti<'lua>, - M: 'static + Send + Fn(&'lua Lua, &T, A) -> Result<R>; + M: 'static + MaybeSend + Fn(&'lua Lua, &T, A) -> Result<R>; /// Add a metamethod as a function which accepts a `&mut T` as the first parameter. /// @@ -237,7 +237,7 @@ pub trait UserDataMethods<'lua, T: UserData> { where A: FromLuaMulti<'lua>, R: ToLuaMulti<'lua>, - M: 'static + Send + FnMut(&'lua Lua, &mut T, A) -> Result<R>; + M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> Result<R>; /// Add a metamethod which accepts generic arguments. /// @@ -248,7 +248,7 @@ pub trait UserDataMethods<'lua, T: UserData> { where A: FromLuaMulti<'lua>, R: ToLuaMulti<'lua>, - F: 'static + Send + Fn(&'lua Lua, A) -> Result<R>; + F: 'static + MaybeSend + Fn(&'lua Lua, A) -> Result<R>; /// Add a metamethod as a mutable function which accepts generic arguments. /// @@ -259,7 +259,7 @@ pub trait UserDataMethods<'lua, T: UserData> { where A: FromLuaMulti<'lua>, R: ToLuaMulti<'lua>, - F: 'static + Send + FnMut(&'lua Lua, A) -> Result<R>; + F: 'static + MaybeSend + FnMut(&'lua Lua, A) -> Result<R>; } /// Trait for custom userdata types. |