Module

alloc::collections::arena_vec

source

Growable sequences stored in a caller-owned arena.

Types

HeaderAn ArenaVec's length and segments, in the arena: segment 0, and a table of the later ones, each twice as long as the one before.
ArenaVecA growable sequence in an arena whose elements never move: a Copy handle whose copies all name the same vec.

Functions

merge_runsOne bottom-up merge pass of ArenaVec::sort_by: merges each pair of adjacent sorted runs of width elements of src into dst.
first_capacityThe size of segment 0: at least 4 elements and 32 bytes, a power of two.
locateThe segment holding element i, and its offset there.
placeWhere element i of h's storage lives.
capacityThe number of elements h's segments hold.
add_segmenth with one more segment, its elements set to fill.

Instances

HashIn[ArenaVec[T, 'k], Domain!['k]]A vec as a key, hashed and compared element by element under the domain's context.

Function declarations

fn merge_runssource

forall T, Env, C where Copy[T], Copy[Env], Sized[T].
unsafe fn merge_runs(&cx: C, src: *T, dst: *T, n: usize, width: usize, cmp: closure[Env](&_: C, T, T) -> Order) { ... }

One bottom-up merge pass of ArenaVec::sort_by: merges each pair of adjacent sorted runs of width elements of src into dst. Ties take from the left run, which keeps the sort stable. Caller: src and dst each hold n elements, in blocks that do not overlap.

fn first_capacitysource

forall T.
fn first_capacity() -> usize { ... }

The size of segment 0: at least 4 elements and 32 bytes, a power of two.

fn locatesource

forall T.
fn locate(i: usize) -> (usize, usize) { ... }

The segment holding element i, and its offset there. Segment k holds first_capacity() << k elements, and the segments before it first_capacity() * (2^k - 1).

fn placesource

forall T, 'k.
unsafe fn place(h: Header[T, 'k], i: usize) -> *T { ... }

Where element i of h's storage lives. Caller: i is below the capacity of h's segments.

fn capacitysource

forall T, 'k.
fn capacity(h: Header[T, 'k]) -> usize { ... }

The number of elements h's segments hold.

fn add_segmentsource

forall T, 'k where Copy[T], Sized[T].
fn add_segment(&tag: Exclusive!['k], &arena: Arena!['k], h: Header[T, 'k], fill: T) -> Header[T, 'k] { ... }

h with one more segment, its elements set to fill.

Instance declarations

instance HashIn[ArenaVec[T, 'k], Domain!['k]]source

forall T, 'k where Copy[T], Sized[T], HashIn[T, Domain!['k]].
instance HashIn[ArenaVec[T, 'k], Domain!['k]] { ... }

A vec as a key, hashed and compared element by element under the domain's context.