Struct send_wrapper::SendWrapper
source · pub struct SendWrapper<T> { /* private fields */ }
Expand description
A wrapper which allows you to move around non-Send
-types between threads, as long as you access the contained
value only from within the original thread and make sure that it is dropped from within the original thread.
Implementations§
source§impl<T> SendWrapper<T>
impl<T> SendWrapper<T>
Trait Implementations§
source§impl<T: Clone> Clone for SendWrapper<T>
impl<T: Clone> Clone for SendWrapper<T>
source§impl<T: Debug> Debug for SendWrapper<T>
impl<T: Debug> Debug for SendWrapper<T>
source§impl<T> Deref for SendWrapper<T>
impl<T> Deref for SendWrapper<T>
source§impl<T> DerefMut for SendWrapper<T>
impl<T> DerefMut for SendWrapper<T>
source§impl<T> Drop for SendWrapper<T>
impl<T> Drop for SendWrapper<T>
source§fn drop(&mut self)
fn drop(&mut self)
Drops the contained value.
§Panics
Dropping panics if it is done from a different thread than the one the SendWrapper<T>
instance has been
created with.
Exceptions:
- There is no extra panic if the thread is already panicking/unwinding. This is because otherwise there would be double panics (usually resulting in an abort) when dereferencing from a wrong thread.
- If
T
has a trivial drop (needs_drop::<T>()
is false) then this method never panics.
impl<T> Send for SendWrapper<T>
impl<T> Sync for SendWrapper<T>
Auto Trait Implementations§
impl<T> Freeze for SendWrapper<T>where
T: Freeze,
impl<T> RefUnwindSafe for SendWrapper<T>where
T: RefUnwindSafe,
impl<T> Unpin for SendWrapper<T>where
T: Unpin,
impl<T> UnwindSafe for SendWrapper<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)