Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bamidev/unsafe-send-sync

Unsafe wrappers for making structs Send and/or Sync in Rust.
https://github.com/bamidev/unsafe-send-sync

Last synced: 28 days ago
JSON representation

Unsafe wrappers for making structs Send and/or Sync in Rust.

Awesome Lists containing this project

README

        

# 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

```rust
use std::thread;
use std::rc::Rc;

fn main() {
let not_send = UnsafeSend::new( Rc::::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);
});
}
```