#send-sync #send #sync #wrapper #unsafe

unsafe-send-sync

Unsafe wrappers for making structs Send and/or Sync

5 releases

0.1.0 Nov 19, 2020
0.0.3 Nov 3, 2020
0.0.2 Nov 3, 2020
0.0.1 Nov 3, 2020
0.0.0 Nov 3, 2020

#24 in #send-sync

Download history 20/week @ 2024-01-20 8/week @ 2024-01-27 75/week @ 2024-02-03 123/week @ 2024-02-10 64/week @ 2024-02-17 106/week @ 2024-02-24 113/week @ 2024-03-02 170/week @ 2024-03-09 102/week @ 2024-03-16 79/week @ 2024-03-23 159/week @ 2024-03-30 112/week @ 2024-04-06 153/week @ 2024-04-13 126/week @ 2024-04-20 16/week @ 2024-04-27 54/week @ 2024-05-04

372 downloads per month
Used in 2 crates

MIT license

5KB
104 lines

Unsafe Send Sync

This is a Rust package that basically provides 3 wrapper types.

  • UnsafeSend
  • UnsafeSync
  • UnsafeSendSync

They can be used to force structs to be Send and/or Sync, which is unsafe of course.

Example

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);
    });
}

No runtime deps