Remove unneeded Sync and Send impls

This commit is contained in:
Tyler Hallada 2020-10-18 20:59:18 -04:00
parent 6513b2903a
commit e0f0f26943
5 changed files with 0 additions and 44 deletions

View File

@ -94,16 +94,6 @@ pub struct RawInteriorRefVec {
pub cap: usize,
}
// Required in order to store results in a thread-safe static cache.
// Rust complains that the raw pointers cannot be Send + Sync. We only ever:
// a) read the values in C++/Papyrus land, and it's okay if multiple threads do that.
// b) from_raw() the pointers back into rust values and then drop them. This could be problematic if another script is still reading at the same time, but I'm pretty sure that won't happen.
// Besides, it's already unsafe to read from a raw pointer
unsafe impl Send for RawInteriorRefVec {}
unsafe impl Send for RawInteriorRef {}
unsafe impl Sync for RawInteriorRefVec {}
unsafe impl Sync for RawInteriorRef {}
// Because C++ does not have Result, -1 means that the request was unsuccessful
#[no_mangle]
pub extern "C" fn create_interior_ref_list(

View File

@ -77,16 +77,6 @@ pub struct RawMerchandiseVec {
pub cap: usize,
}
// Required in order to store results in a thread-safe static cache.
// Rust complains that the raw pointers cannot be Send + Sync. We only ever:
// a) read the values in C++/Papyrus land, and it's okay if multiple threads do that.
// b) from_raw() the pointers back into rust values and then drop them. This could be problematic if another script is still reading at the same time, but I'm pretty sure that won't happen.
// Besides, it's already unsafe to read from a raw pointer
unsafe impl Send for RawMerchandiseVec {}
unsafe impl Send for RawMerchandise {}
unsafe impl Sync for RawMerchandiseVec {}
unsafe impl Sync for RawMerchandise {}
#[no_mangle]
pub extern "C" fn create_merchandise_list(
api_url: *const c_char,

View File

@ -38,14 +38,6 @@ pub struct RawOwner {
pub mod_version: u32,
}
// Required in order to store results in a thread-safe static cache.
// Rust complains that the raw pointers cannot be Send + Sync. We only ever:
// a) read the values in C++/Papyrus land, and it's okay if multiple threads do that.
// b) from_raw() the pointers back into rust values and then drop them. This could be problematic if another script is still reading at the same time, but I'm pretty sure that won't happen.
// Besides, it's already unsafe to read from a raw pointer
unsafe impl Send for RawOwner {}
unsafe impl Sync for RawOwner {}
#[no_mangle]
pub extern "C" fn create_owner(
api_url: *const c_char,

View File

@ -6,11 +6,3 @@ pub enum FFIResult<T> {
Ok(T),
Err(*const c_char),
}
// Required in order to store results in a thread-safe static cache.
// Rust complains that the raw pointers cannot be Send + Sync. We only ever:
// a) read the values in C++/Papyrus land, and it's okay if multiple threads do that.
// b) from_raw() the pointers back into rust values and then drop them. This could be problematic if another script is still reading at the same time, but I'm pretty sure that won't happen.
// Besides, it's already unsafe to read from a raw pointer
unsafe impl<T> Send for FFIResult<T> {}
unsafe impl<T> Sync for FFIResult<T> {}

View File

@ -39,14 +39,6 @@ pub struct RawShop {
pub description: *const c_char,
}
// Required in order to store results in a thread-safe static cache.
// Rust complains that the raw pointers cannot be Send + Sync. We only ever:
// a) read the values in C++/Papyrus land, and it's okay if multiple threads do that.
// b) from_raw() the pointers back into rust values and then drop them. This could be problematic if another script is still reading at the same time, but I'm pretty sure that won't happen.
// Besides, it's already unsafe to read from a raw pointer
unsafe impl Send for RawShop {}
unsafe impl Sync for RawShop {}
#[no_mangle]
pub extern "C" fn create_shop(
api_url: *const c_char,