Module

alloc::collections::vec

source

Growable owning sequences of values.

Types

Vec!A growable array that owns its heap block, under brand 'k.
OwnedVec!A Vec! packaged with its capability, for a vector kept across calls or in a loop variable without naming its brand.
VecIter!A vector's elements in order, read under its capability, which the iterator holds with the vector while it runs; finish hands both back.
OwnedVecIter!An OwnedVec!'s elements in order; finish hands the vector back.

Functions

beforeWhether the element at i orders before the one at j; both stay put.
swap_atExchanges the elements at i and j of the block at p, by moves.
sift_downRestores the max-heap below root within the first end elements.
forget_copyLets a Copy element go: the callback destroy passes to destroy_with.

Instances

Iterator[VecIter![T, 'k] -> T]The vec's elements in order, copied out under its capability.
Iterator[OwnedVecIter![T] -> T]The vector's elements in order, copied out.

Function declarations

fn beforesource

forall T, Env where Copy[Env], Sized[T].
unsafe fn before(p: *T, i: usize, j: usize, cmp: closure[Env](T, T) -> (T, T, Order)) -> bool { ... }

Whether the element at i orders before the one at j; both stay put. Caller: both indices are below the number of initialized elements at p, which nothing else touches during the call.

fn swap_atsource

forall T where Sized[T].
unsafe fn swap_at(p: *T, i: usize, j: usize) -> () { ... }

Exchanges the elements at i and j of the block at p, by moves. Caller: both indices are below the number of initialized elements at p, which nothing else touches during the call. Used by the Vec! operations that move elements; not meant for direct use.

fn sift_downsource

forall T, Env where Copy[Env], Sized[T].
unsafe fn sift_down(p: *T, root: usize, end: usize, cmp: closure[Env](T, T) -> (T, T, Order)) -> () { ... }

Restores the max-heap below root within the first end elements. Caller: end is at most the number of initialized elements at p, which nothing else touches during the call.

fn forget_copysource

forall T where Copy[T].
fn forget_copy(value: T) -> () { ... }

Lets a Copy element go: the callback destroy passes to destroy_with. Not meant for direct use.

Instance declarations

instance Iterator[VecIter![T, 'k] -> T]source

forall T, 'k where Copy[T], Sized[T].
instance Iterator[VecIter![T, 'k] -> T] { ... }

The vec's elements in order, copied out under its capability.

instance Iterator[OwnedVecIter![T] -> T]source

forall T where Copy[T], Sized[T].
instance Iterator[OwnedVecIter![T] -> T] { ... }

The vector's elements in order, copied out.

Blanket methods

method collect_vecsource

fn collect_vec(self) -> (I, OwnedVec![T]) { ... }

In forall I, T where Iterator[I -> T], Sized[T].

The iterator's remaining items, in order, in a new vector.