Skip to content
CryoCryo home
Stdlibcore

marker

import std::core::marker; — in the prelude · source

Three traits with no methods. Implementing one adds no behaviour; it tells the compiler and generic code something about the type's semantics.

Copy

type trait Copy {}

Values duplicate with a bitwise copy. Integers, floats, pointers, and pure-POD structs qualify; anything owning a resource does not. A Copy type never needs an explicit clone, and assignment does not move out of it. This is enforced by the move-checker. The only explicit impl in the library is implement trait Copy for VaArgs; the primitives are Copy by definition.

Send

type trait Send {}

Safe to transfer between threads.

Sync

type trait Sync {}

Safe to share between threads by reference; T: Sync when &T: Send.

Send and Sync are computed structurally and checked at any explicit where T: Send bound. The thread entry points carry those bounds, so moving a non-Send payload — an Rc<T>, a lock guard — into another thread is a compile error. See Ownership, Copy, and Drop for the full rules.