pub trait VecExt<T> {
    fn try_with_capacity(capacity: usize) -> Result<Vec<T>, AllocError>;
    fn new_populated_by_copy(
        capacity: usize,
        copy: T
    ) -> Result<Vec<T>, AllocError>
    where
        T: Copy
; fn new_populated_fallibly<Populator: FnOnce(usize) -> Result<T, AllocError> + Copy>(
        capacity: usize,
        populator: Populator
    ) -> Result<Vec<T>, AllocError>; fn push_unchecked(&mut self, value: T); }
Expand description

Vec<T> extension trait.

Required Methods

Creates a new instance with the given capacity or fails.

Done this way instead of repeated push() or specialized extend() to minimize if checks for each push() and give LLVM’s loop unrolling a chance to optimize.

Done this way instead of repeated push() or specialized extend() to minimize if checks for each push() and give LLVM’s loop unrolling a chance to optimize.

Push without checking capacity.

Implementations on Foreign Types

Implementors