Struct thread_safe::ThreadSafe [−][src]
pub struct ThreadSafe<T: ?Sized> { /* fields omitted */ }
Expand description
The whole point.
This structure wraps around thread-unsafe data and only allows access if it comes from the thread that the data originated from. This allows thread-unsafe data to be used in thread-safe structures, as long as the data is only used from the originating thread.
Panics
If the ThreadSafe is dropped in a foreign thread, it will panic. This is because running the drop handle
for the inner data is considered to be using it in a thread-unsafe context.
Implementations
Create a new instance of a ThreadSafe.
Attempt to convert to the inner type. This errors if it is not in the origin thread.
Attempt to convert to the inner type, using a thread key.
Attempt to convert to the inner type. This panics if it is not in the origin thread.
Attempt to convert to the inner type, using a thread key.
Try to get a reference to the inner type. This errors if it is not in the origin thread.
Try to get a reference to the inner type, using a thread key.
Get a reference to the inner type. This panics if it is not called in the origin thread.
Get a reference to the inner type, using a thread key.
Try to get a mutable reference to the inner type. This errors if it is not in the origin thread.
Try to get a mutable reference to the inner type, using a thread key.
Get a mutable reference to the inner type. This panics if it is not called in the origin thread.
Get a mutable reference to the inner type, using a thread key.
Try to clone this value. This errors if we are not in the origin thread.
Try to clone this value, using a thread key.
Clone this value, using a thread key.
Trait Implementations
Clone this value. This panics if it takes place outside of the origin thread.
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for ThreadSafe<T> where
T: RefUnwindSafe, impl<T: ?Sized> Unpin for ThreadSafe<T> where
T: Unpin, impl<T: ?Sized> UnwindSafe for ThreadSafe<T> where
T: UnwindSafe, Blanket Implementations
Mutably borrows from an owned value. Read more