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

Create a SendWrapper wrapper around a value of type T. The wrapper takes ownership of the value.

Returns if the value can be safely accessed from within the current thread.

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

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.

The resulting type after dereferencing.

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.

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.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.