Struct send_cell::SendCell[][src]

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

An immutable memory location that implements Send for types that do not implement it

Enforcing safety with regard to the Send trait happens at runtime instead of compile time. Accessing the contained value will call panic! if happening from any thread but the thread on which the value was created on. The SendCell can be safely transferred to other threads.

Warning

Any other usage from a different thread will lead to a panic, i.e. using any of the traits implemented on SendCell like Eq.

Calling drop on a SendCell or otherwise freeing the value from a different thread than the one where it was created also results in a panic.

Methods

impl<T> SendCell<T>
[src]

Creates a new SendCell containing value.

Consumes the SendCell, returning the wrapped value.

Panics

Panics if called from a different thread than the one where the original value was created.

Consumes the SendCell, returning the wrapped value if successful.

The wrapped value is returned if this is called from the same thread as the one where the original value was created, otherwise the SendCell is returned as Err(self).

Immutably borrows the wrapped value.

Multiple immutable borrows can be taken out at the same time.

Panics

Panics if called from a different thread than the one where the original value was created.

Tries to immutably borrow the wrapped value.

None is returned if called from a different thread than the one where the original value was created.

Multiple immutable borrows can be taken out at the same time.

Immutably borrows the wrapped value.

The borrow lasts until the returned Ref exits scope. Multiple immutable borrows can be taken out at the same time.

Panics

Panics if called from a different thread than the one where the original value was created.

Tries to immutably borrow the wrapped value.

None is returned if called from a different thread than the one where the original value was created.

The borrow lasts until the returned Ref exits scope. Multiple immutable borrows can be taken out at the same time.

Trait Implementations

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

Performs the conversion.

impl<T: Default> Default for SendCell<T>
[src]

Returns the "default value" for a type. Read more

impl<T: Clone> Clone for SendCell<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Debug> Debug for SendCell<T>
[src]

Formats the value using the given formatter. Read more

impl<T: PartialEq> PartialEq<SendCell<T>> for SendCell<T>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T: Eq> Eq for SendCell<T>
[src]

impl<T: PartialOrd> PartialOrd<SendCell<T>> for SendCell<T>
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: Ord> Ord for SendCell<T>
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl<T: Hash> Hash for SendCell<T>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<T> Send for SendCell<T>
[src]

Auto Trait Implementations

impl<T> Sync for SendCell<T> where
    T: Sync