mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
Add optional Send requirement to internall callbacks
This commit is contained in:
+9
-1
@@ -46,6 +46,10 @@ unsafe impl Send for LightUserData {}
|
||||
#[cfg(feature = "send")]
|
||||
unsafe impl Sync for LightUserData {}
|
||||
|
||||
#[cfg(feature = "send")]
|
||||
pub(crate) type Callback = Box<dyn Fn(&RawLua, c_int) -> Result<c_int> + Send + 'static>;
|
||||
|
||||
#[cfg(not(feature = "send"))]
|
||||
pub(crate) type Callback = Box<dyn Fn(&RawLua, c_int) -> Result<c_int> + 'static>;
|
||||
|
||||
pub(crate) struct Upvalue<T> {
|
||||
@@ -55,7 +59,11 @@ pub(crate) struct Upvalue<T> {
|
||||
|
||||
pub(crate) type CallbackUpvalue = Upvalue<Callback>;
|
||||
|
||||
#[cfg(feature = "async")]
|
||||
#[cfg(all(feature = "async", feature = "send"))]
|
||||
pub(crate) type AsyncCallback =
|
||||
Box<dyn for<'a> Fn(&'a RawLua, c_int) -> BoxFuture<'a, Result<c_int>> + Send + 'static>;
|
||||
|
||||
#[cfg(all(feature = "async", not(feature = "send")))]
|
||||
pub(crate) type AsyncCallback =
|
||||
Box<dyn for<'a> Fn(&'a RawLua, c_int) -> BoxFuture<'a, Result<c_int>> + 'static>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user