Trait

std::cap::Access

source

Re-exported from core::cap::Access.

forall Self -> 'k, R.
trait Access {
    /// The capability taken out of `cx`, and the rest of the context.
    fn open(cx: Self) -> (Exclusive!['k], R);
    /// The context again, from the capability and the rest `open` returned.
    fn close(tag: Exclusive!['k], rest: R) -> Self;
}

A context that lends the capability of domain 'k: the Exclusive!['k] itself, or a value holding it, such as an arena with its capability (alloc::arena::Domain!) or a program's own context. Code that reads or writes the domain takes &cx: C with where Access[C -> 'k, R], opens it for the capability, and closes it again before it returns:

let (tag, rest) = Access[C -> 'k, R]::open(cx);
... &tag ...
cx = Access[C -> 'k, R]::close(tag, rest);

R is what the context holds besides the capability, handed back whole. The capability is really taken out and put back, never assumed: an instance cannot make an Exclusive!['k] it does not hold.

Methods

method opensource

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

The capability taken out of cx, and the rest of the context.

method closesource

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

The context again, from the capability and the rest open returned.

Implementors

instance Access[Exclusive!['k] -> 'k, ()]source

forall 'k.
instance Access[Exclusive!['k] -> 'k, ()] { ... }

In std::cap.

An Exclusive! lends itself, with nothing else held.

instance Access[Domain!['k] -> 'k, Arena!['k]]source

forall 'k.
instance Access[Domain!['k] -> 'k, Arena!['k]] { ... }

In std::arena.

A domain lends its capability, with its arena as the rest.