thisisplural
#[derive(Plural)] for creating frictionless new types with any collection
type.
Features
- Automatically implements
From,Into,FromIterator,IntoIterator, and methods like.len()or::with_capacity. - Supports any collection that behaves like
VecandHashMap.
Example
// This implements `From`, `Into`, `FromIterator`, `IntoIterator`.
;
// use `From` trait
let my_favorite_numbers: Numbers = vec!.into;
// methods like `len()` are implemented
assert_eq!;
assert!;
// `FromIterator` allows this `collect()`
let doubled_numbers: Numbers = my_favorite_numbers.iter.map.collect;
// `HashMap` like collections are also supported
;
// construct the struct with using `FromIterator`
let favorite_numbers =
from_iter;
// use it in a `for` loop (`IntoIterator` trait)
for in favorite_numbers