vecmerge

Crates.iovecmerge
lib.rsvecmerge
version0.0.3
sourcesrc
created_at2019-05-27 19:02:12.611551
updated_at2019-05-30 13:48:32.585953
descriptionA macro for merging vectors
homepage
repositoryhttps://github.com/segeljakt/vecmerge
max_upload_size
id137392
size3,943
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