Crates.io | unsafe-send-sync |
lib.rs | unsafe-send-sync |
version | 0.1.0 |
source | src |
created_at | 2020-11-03 17:24:46.794021 |
updated_at | 2020-11-19 20:23:32.671729 |
description | Unsafe wrappers for making structs Send and/or Sync. |
homepage | |
repository | https://github.com/bamilab/unsafe-send-sync |
max_upload_size | |
id | 308324 |
size | 9,746 |
This is a Rust package that basically provides 3 wrapper types.
They can be used to force structs to be Send and/or Sync, which is unsafe of course.
use std::thread;
use std::rc::Rc;
fn main() {
let not_send = UnsafeSend::new( Rc::<u32>::new( 1337 ) );
assert!( not_send.strong_count() == 1,
"We can't really send a reference counted pointer across threads unless it only has one reference." );
thread::spawn(move || {
println!("We found a number: {}", *not_send);
});
}