merge_array

Macro merge_array 

Source
macro_rules! merge_array {
    ([
		$( $value:expr ),* $(,)?
	]) => { ... };
}
Expand description

Merge multiple Arrays into one combined Array.

Notice that each component Array’s size must be known before hand.

The macro expects an array list [a,b,c] expression with each element being an Array.

The result of this macro will be a single Array value that contains the concatination of all vaules from all the given arrays.

This macro is the reversal of the split_array macro.

§Syntax

merge_array!{
    \[
        ( <array-vaule> , )*
    \];
}

§Example

use hybrid_array::Array;
use hybrid_array::sizes::U2;
use hybrid_array::sizes::U4;
use array_fusion::merge_array;

let foo: Array<_, U2> = Array([1, 2]);
let bar: Array<_, U4> = Array([0x12, 0x34, 0x56, 0x78]);

let combi: Array<_,_> = merge_array!(
    [
        foo,
        bar,
    ]
);

assert_eq!(combi, [
	1, 2, // foo
    0x12, 0x34, 0x56, 0x78, // bar
]);