rokdocs
v0.1

rok::core::marker

Marker traits used by #[derive(...)] (spec 6.2/6.4) and other compiler-driven semantics. Slots follow stdlib spec 0.4 (6.4.8). The comparison / hashing traits live in cmp.rok.

Structs

Handoff

pub struct Handoff<T>

A value handed between threads under an outside protocol (a join, a lock, a channel hand-off) that keeps any two threads from using it at once: Send + Sync whenever the value is Send, even when it is not Sync (a collection).

  • pub const unsafe fn new(value: T) -> Handoff<T>

    The caller guarantees the protocol: no two threads use value (or another copy of its handle) at the same time.

  • pub const fn get(self) -> T
Trait implementations 2
  • unsafe impl<T: Send> Send for Handoff<T>
  • unsafe impl<T: Send> Sync for Handoff<T>

Memo

pub struct Memo

The copies one hand-off made, by original object, and the copied buffers left to fix. none for one collection whose elements need no copy: nothing can be reached twice. A visit (distinct) notes what each item reaches in vis instead.

Traits

Clone

pub trait Clone
  • fn clone(self) -> Self

Default

pub trait Default

A type's default value (0, false, '\0', "", empty collections); #[derive(Default)] defaults every field.

  • fn default() -> Self

Copy

pub trait Copy: Clone

Bitwise copy is a correct duplicate (stdlib 2.13.3). A marker: every value already copies on let y = x;; #[derive(Copy)] checks that every field is Copy and the type is not Drop.

Drop

pub trait Drop
  • fn drop(ref self)

Send

pub trait Send

Sync

pub trait Sync

Transfer

pub trait Transfer

How a standard handle copies itself for a hand-off: transfer_copy makes the copy (its elements queued on the memo), transfer_keep notes the handle as its own copy. Only the compiler's list of standard types is called; other impls are ignored.

  • fn transfer_copy(self, m: Memo) -> Self
  • fn transfer_keep(self, m: Memo) -> Self
  • fn transfer_visit(self, m: Memo) -> Self

    Note the handle for the memo's owner (Memo::visit), its elements queued.

Type aliases

NoneSentinel

pub type NoneSentinel = none

The type of the none literal (stdlib 2.13.8): the compiler's built-in none, here under its library name.

Functions

default_of

pub const fn default_of<T: Default>() -> T

T::default() where only the expected type names T (#[derive(Default)] field initializers).

hand_over

pub fn hand_over<T>(x: T) -> T

What a hand-off gives the new owner: x with a copy of every collection it reaches (x itself, with no call, when there are none).