Struct tetsy_send_wrapper::SendWrapper[][src]

pub struct SendWrapper<T> { /* fields omitted */ }

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 wrapper around a value of type T. The wrapper takes ownership of the value.

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 instance has been created with.

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 instance has been created with.

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 instance has been created with.

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 instance has been created with. As an exception, 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.

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

impl<T> Unpin for SendWrapper<T>

impl<T> UnwindSafe for SendWrapper<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.