vecmerge-impl

Crates.iovecmerge-impl
lib.rsvecmerge-impl
version0.0.3
sourcesrc
created_at2019-05-27 19:01:12.939967
updated_at2019-05-30 13:46:34.664699
descriptionA macro for merging vectors
homepage
repositoryhttps://github.com/segeljakt/vecmerge
max_upload_size
id137391
size4,573
Klas Segeljakt (segeljakt)

documentation

README

vecmerge

A macro for merging vectors.

Examples

use vecmerge::vecmerge;

assert_eq! {
    vecmerge!([1, 2, 3] + [4, 5] + [6]),
    vec![1, 2, 3, 4, 5, 6],
}

let a = vec![1, 2, 3];
let b = vec![6];

assert_eq! {
    vecmerge!(a + [4, 5] + b),
    vec![1, 2, 3, 4, 5, 6],
}

assert_eq! {
    vecmerge!(vec![1, 2, 3] + vec![4, 5, 6]),
    vec![1, 2, 3, 4, 5, 6],
}

assert_eq! {
    vecmerge!([Some(1)]? + [None]? + [Some(3)]? + [4, 5, 6]),
    vec![1, 3, 4, 5, 6],
}

assert_eq! {
    vecmerge!([Some(1), Some(2), Some(3)]? + [4, 5, 6]),
    vec![1, 2, 3, 4, 5, 6],
}

assert_eq! {
    vecmerge!([Some(1), None, Some(3)]? + [4, 5, 6]),
    vec![4, 5, 6],
}
Commit count: 9

cargo fmt