Type Alias NotThreadSafe

Source
pub type NotThreadSafe = PhantomData<*mut ()>;
Expand description

Zero-sized type to mark types not Send.

Add this type as a field to your struct if your type should not be sent to a different task. Since Send is an auto trait, adding a single field that is !Send will ensure that the whole type is !Send.

If a type is !Send it is impossible to give control over an instance of the type to another task. This is useful to include in types that store or reference task-local information. A file descriptor is an example of such task-local information.

This type also makes the type !Sync, which prevents immutable access to the value from several threads in parallel.

Aliased Typeยง

struct NotThreadSafe;