Struct parity_send_wrapper::SendWrapper [−][src]
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
impl<T> SendWrapper<T>
[src]
pub fn new(data: T) -> SendWrapper<T>
[src]
Create a SendWrapper
pub fn valid(&self) -> bool
[src]
Returns if the value can be safely accessed from within the current thread.
pub fn take(self) -> T
[src]
Takes the value out of the SendWrapper.
#Panics
Panics if it is called from a different thread than the one the SendWrapper
Trait Implementations
impl<T> Deref for SendWrapper<T>
[src]
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T
[src]
Returns a reference to the contained value.
Panics
Derefencing panics if it is done from a different thread than the one the SendWrapper
impl<T> DerefMut for SendWrapper<T>
[src]
fn deref_mut(&mut self) -> &mut T
[src]
Returns a mutable reference to the contained value.
Panics
Derefencing panics if it is done from a different thread than the one the SendWrapper
impl<T> Drop for SendWrapper<T>
[src]
fn drop(&mut self)
[src]
Drops the contained value.
Panics
Dropping panics if it is done from a different thread than the one the SendWrapper
impl<T> Send for SendWrapper<T>
[src]
impl<T> Sync for SendWrapper<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for SendWrapper<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Unpin for SendWrapper<T>
impl<T> UnwindSafe for SendWrapper<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,