unsafe-send-sync 0.1.0

Unsafe wrappers for making structs Send and/or Sync.
Documentation
  • Coverage
  • 23.08%
    3 out of 13 items documented0 out of 10 items with examples
  • Size
  • Source code size: 9.38 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 759.31 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • bamidev/unsafe-send-sync
    3 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • bamidev

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