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.