#slice #boxed-slice #nums

boxchop

A crate for creating boxed slices

1 unstable release

0.1.0 Aug 20, 2020

#2978 in Rust patterns

MIT license

9KB
77 lines

boxchop

Documentation | View on libs.rs

A tiny library for creating boxed slices Box<[T]>.

let nums = boxchop::new_with(5, |x| x + 1);

assert_eq!(
    nums,
    Box::from([1, 2, 3, 4, 5]),
);

⚠️ This was created before I found the new_uninit nightly feature. The fundamental itch this crate scratches will eventually be part of the standard library: see Box::new_uninit_slice and Box::assume_init.


lib.rs:

A small library for creating boxed slices Box<[T]>.

No runtime deps