Trait swiss_army_knife::vec::VecExt[][src]

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>; }
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.

Implementations on Foreign Types

Implementors