| Crates.io | atomic-slot |
| lib.rs | atomic-slot |
| version | 0.1.0 |
| created_at | 2025-06-21 18:15:53.563753+00 |
| updated_at | 2025-06-21 18:15:53.563753+00 |
| description | A simple, lock-free, atomic slot for transferring ownership of Box |
| homepage | |
| repository | https://github.com/TroyNeubauer/atomic-slot |
| max_upload_size | |
| id | 1720996 |
| size | 25,388 |
A simple, lock-free, atomic slot for transferring ownership of Box<T>.
The AtomicSlot<T> holds at most one Box<T> and allows you to swap, take or
store an optional value using only atomic operations.
use atomic_slot::AtomicSlot;
use std::sync::atomic::Ordering;
let slot = AtomicSlot::new(Box::new(7));
assert_eq!(*slot.take().unwrap(), 7);
assert!(slot.is_none());