
sendify-rs
An unsafe crate to wrap a reference to make it Send + Sync. Make sure the reference is still valid when unwrapping it.
Docs
Install
Add this to your Cargo.toml file:
[dependencies]
sendify = "1.0"
Example
use sendify::Sendify;
use std::thread;
fn main() {
let data = "my string".to_owned();
let ref_val = &data;
let sendify_val = Sendify::wrap(ref_val);
thread::spawn(move || {
let ref_val = unsafe { sendify_val.unwrap() };
assert_eq!(ref_val, "my string")
})
.join()
.unwrap();
assert_eq!(data, "my string")
}
Contributing
Your PRs and suggestions are always welcome.