Mark LightUserData as Send+Sync (send feature flag)

This commit is contained in:
Alex Orlenko
2024-07-31 11:13:48 +01:00
parent 2f8755dcc7
commit a86d6ab330
2 changed files with 12 additions and 0 deletions
+5
View File
@@ -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> {
+7
View File
@@ -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);
}