ThreadAlone<T>
This is a fork of dtolnay's threadbound crate, which allows implementing Send on non-Copy types.
The reason that the original crate does not allow it is, if a ThreadBound object dropped on another thread from where it was created, it cannot be handled in any way.
Instead, this crate aborts if that happens: so be very cautious when using this crate on multi-threaded environemnt.
ThreadBound<T>
ThreadBound is a wrapper that binds a value to its original thread. The wrapper
gets to be Sync and Send but only the original thread on which the
ThreadBound was constructed can retrieve the underlying value.
[]
= "0.1"
Version requirement: rustc 1.31+
Example
extern crate threadbound;
use PhantomData;
use Rc;
use Arc;
use ThreadBound;
// Neither Send nor Sync. Maybe the index points into a
// thread-local interner.
// Error types are always supposed to be Send and Sync.
// We can use ThreadBound to make it so.