diff --git a/src/types.rs b/src/types.rs index 8c6810e..9060bfa 100644 --- a/src/types.rs +++ b/src/types.rs @@ -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 Result + 'static>; pub(crate) struct Upvalue { diff --git a/src/value.rs b/src/value.rs index fe2a27d..2429910 100644 --- a/src/value.rs +++ b/src/value.rs @@ -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); }