Module std::markerStable [-] [+] [src]

Primitive traits and marker types representing basic 'kinds' of types.

Rust types can be classified in various useful ways according to intrinsic properties of the type. These classifications, often called 'kinds', are represented as traits.

They cannot be implemented by user code, but are instead implemented by the compiler automatically for the types to which they apply.

Marker types are special types that are used with unsafe code to inform the compiler of special constraints. Marker types should only be needed when you are creating an abstraction that is implemented using unsafe code. In that case, you may want to embed some of the marker types below into your type.

Structs

`'>ContravariantLifetime

Old-style marker trait. Deprecated.

ContravariantType

Old-style marker trait. Deprecated.

`'>CovariantLifetime

Old-style marker trait. Deprecated.

CovariantType

Old-style marker trait. Deprecated.

>`'>InvariantLifetime

Old-style marker trait. Deprecated.

InvariantType

Old-style marker trait. Deprecated.

Managed

A type which is considered managed by the GC. This is typically embedded in other types.

NoCopy

A type which is considered "not POD", meaning that it is not implicitly copyable. This is typically embedded in other types to ensure that they are never copied, even if they lack a destructor.

PhantomData

PhantomData is a way to tell the compiler about fake fields. Phantom data is required whenever type parameters are not used. The idea is that if the compiler encounters a PhantomData<T> instance, it will behave as if an instance of the type T were present for the purpose of various automatic analyses.

Traits

Copy

Types that can be copied by simply copying bits (i.e. memcpy).

MarkerTrait

MarkerTrait is intended to be used as the supertrait for traits that don't have any methods but instead serve just to designate categories of types. An example would be the Send trait, which indicates types that are sendable: Send does not itself offer any methods, but instead is used to gate access to data.

PhantomFn

PhantomFn is a marker trait for use with traits that contain type or lifetime parameters that do not appear in any of their methods. In that case, you can either remove those parameters, or add a PhantomFn supertrait that reflects the signature of methods that compiler should "pretend" exists. This most commonly occurs for traits with no methods: in that particular case, you can extend MarkerTrait, which is equivalent to PhantomFn<Self>.

Send

Types able to be transferred across thread boundaries.

Sized

Types with a constant size known at compile-time.

Sync

Types that can be safely shared between threads when aliased.