stackvec 0.2.1

A crate to use stack-allocated Vectors (performance and/or no-std)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Example to see how "human-readable" the collection error message is.
// $ cargo run --example try_collect_panic

#![allow(unused_variables)]

extern crate stackvec; use ::stackvec::prelude::*;

fn main ()
{
    let array: [_; 3] = [1, 2, 3];

    let doubled: [_; 5] = array
                            .iter()
                            .map(|&x| 2 * x)
                            .try_collect()
                            .expect("Missing elements to collect")
    ;
}