#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

#26 in #send-sync

Download history 95/week @ 2024-03-17 71/week @ 2024-03-24 159/week @ 2024-03-31 121/week @ 2024-04-07 144/week @ 2024-04-14 126/week @ 2024-04-21 14/week @ 2024-04-28 56/week @ 2024-05-05 46/week @ 2024-05-12 54/week @ 2024-05-19 34/week @ 2024-05-26 60/week @ 2024-06-02 13/week @ 2024-06-09 31/week @ 2024-06-16 42/week @ 2024-06-23 2/week @ 2024-06-30

91 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