Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/bamidev/unsafe-send-sync
- Owner: bamidev
- License: mit
- Created: 2020-11-03T17:10:17.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-30T09:22:46.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T11:52:28.035Z (2 months ago)
- Language: Rust
- Size: 5.86 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Unsafe Send Sync
This is a Rust package that basically provides 3 wrapper types.
* UnsafeSend
* UnsafeSync
* UnsafeSendSyncThey 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);
});
}
```