Send

A Send type is safe to send to multiple threads. This implies that the type is a move type. Types that aren't Send are pointer types such as &T, unless T is Sync.

The Send trait has the following type signature in the standard library's std::marker module:

pub unsafe auto trait Send { }

There are three important things to notice in its definition: first, it's a marker trait without any body or item. Second, it's prefixed with the auto keyword as it is implemented implicitly for most types when appropriate. Thirdly, it's an unsafe trait because Rust wants to make the developer sure that they opt in explicitly and ensure that their type has thread-safe synchronization built in.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset