Crates.io | vecmerge |
lib.rs | vecmerge |
version | 0.0.3 |
source | src |
created_at | 2019-05-27 19:02:12.611551 |
updated_at | 2019-05-30 13:48:32.585953 |
description | A macro for merging vectors |
homepage | |
repository | https://github.com/segeljakt/vecmerge |
max_upload_size | |
id | 137392 |
size | 3,943 |
A macro for merging vectors.
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],
}