mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
Mark LightUserData as Send+Sync (send feature flag)
This commit is contained in:
@@ -41,6 +41,11 @@ pub(crate) enum SubtypeId {
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||
pub struct LightUserData(pub *mut c_void);
|
||||
|
||||
#[cfg(feature = "send")]
|
||||
unsafe impl Send for LightUserData {}
|
||||
#[cfg(feature = "send")]
|
||||
unsafe impl Sync for LightUserData {}
|
||||
|
||||
pub(crate) type Callback<'a> = Box<dyn Fn(&'a RawLua, c_int) -> Result<c_int> + 'static>;
|
||||
|
||||
pub(crate) struct Upvalue<T> {
|
||||
|
||||
@@ -934,6 +934,13 @@ pub trait FromLuaMulti: Sized {
|
||||
mod assertions {
|
||||
use super::*;
|
||||
|
||||
#[cfg(not(feature = "send"))]
|
||||
static_assertions::assert_not_impl_any!(Value: Send);
|
||||
#[cfg(not(feature = "send"))]
|
||||
static_assertions::assert_not_impl_any!(MultiValue: Send);
|
||||
|
||||
#[cfg(feature = "send")]
|
||||
static_assertions::assert_impl_all!(Value: Send, Sync);
|
||||
#[cfg(feature = "send")]
|
||||
static_assertions::assert_impl_all!(MultiValue: Send, Sync);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user