unsized-vec

docs.rs Crates.io

UnsizedVec<T> is like Vec<T>, but T can be ?Sized.

Features

Example

```rust

![feature(unsizedfnparams)]

use core::fmt::Debug; use unsizedvec::{*, emplace::boxnew_with};

// Box::new() necessary only to coerce the values to trait objects. let obj: Box = Box::new(1); let obj2: Box = Box::new((97u128, "oh noes")); let mut vec: UnsizedVec = unsizedvec![*obj, *obj2]; for traitobj in &vec { dbg!(traitobj); };

assert_eq!(vec.len(), 2);

let popped = boxnewwith(|e| vec.pop_unwrap(e)); dbg!(&*popped);

assert_eq!(vec.len(), 1); ```

License

unsized-vec is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.