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

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

Takes the value out of the SendWrapper<T>.

Panics

Panics if it is called from a different thread than the one the SendWrapper<T> instance has been created with.

Trait Implementations

Returns a copy of the value.

Panics

Cloning panics if it is done from a different thread than the one the SendWrapper<T> instance has been created with.

Performs copy-assignment from source. Read more

Formats the value using the given formatter.

Panics

Formatting panics if it is done from a different thread than the one the SendWrapper<T> instance has been created with.

Returns a reference to the contained value.

Panics

Dereferencing panics if it is done from a different thread than the one the SendWrapper<T> instance has been created with.

The resulting type after dereferencing.

Returns a mutable reference to the contained value.

Panics

Dereferencing panics if it is done from a different thread than the one the SendWrapper<T> 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<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.

Polls this SendWrapper Future.

Panics

Polling panics if it is done from a different thread than the one the SendWrapper instance has been created with.

The type of value produced on completion.

Polls this SendWrapper Stream.

Panics

Polling panics if it is done from a different thread than the one the SendWrapper instance has been created with.

Values yielded by the stream.

Returns the bounds on the remaining length of the stream. Read more

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.

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

🔬 This is a nightly-only experimental API. (into_future)

Creates a future from a value.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type of successful values yielded by this future

The type of failures yielded by this future

Poll this TryFuture as if it were a Future. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type of successful values yielded by this future

The type of failures yielded by this future

Poll this TryStream as if it were a Stream. Read more