Trait

alloc::arena::Allocate

source
forall Self -> 'k, R.
trait Allocate {
    /// Takes the capability, the arena and the rest of the context out of `cx`.
    fn open(cx: Self) -> (Exclusive!['k], Arena!['k], R);
    /// Puts the capability, the arena and the rest back together as the context.
    fn close(tag: Exclusive!['k], arena: Arena!['k], rest: R) -> Self;
}

A context that lends an arena with its capability. It is what code that allocates in domain 'k takes, as &cx: C with where Allocate[C -> 'k, R], the way code that only reads or writes it takes core::cap::Access. Domain!['k] is the plain pair; a program may keep both in a context of its own and lend them through these instances.

let (tag, arena, rest) = Allocate[C -> 'k, R]::open(cx);
let r = &arena.alloc(&tag, value);
cx = Allocate[C -> 'k, R]::close(tag, arena, rest);

Arena!::alloc, alloc_slice and alloc_bytes are the primitives the context forms below call once a context is open.

Methods

method opensource

fn open(cx: Self) -> (Exclusive!['k], Arena!['k], R);

Takes the capability, the arena and the rest of the context out of cx.

method closesource

fn close(tag: Exclusive!['k], arena: Arena!['k], rest: R) -> Self;

Puts the capability, the arena and the rest back together as the context.

Implementors

instance Allocate[Domain!['k] -> 'k, ()]source

forall 'k.
instance Allocate[Domain!['k] -> 'k, ()] { ... }

In alloc::arena.

A domain lends its arena with its capability.