Crates.io | arrcat |
lib.rs | arrcat |
version | 0.1.1 |
source | src |
created_at | 2022-04-08 05:10:21.465495 |
updated_at | 2022-04-08 06:18:52.290705 |
description | Array concatenation |
homepage | |
repository | https://github.com/rodrimati1992/arrcat/ |
max_upload_size | |
id | 564035 |
size | 27,529 |
Array concatenation
This crate allows concatenating multiple arrays of varying lengths into one array.
concat_arrays
For more examples of using concat_arrays
,
you can look here.
use arrcat::concat_arrays;
{
const PRIMES: [u16; 4] = [7, 11, 13, 17];
assert_eq!(
concat_arrays!([3, 4, 4u16.pow(3)], PRIMES),
[3, 4, 64, 7, 11, 13, 17],
);
}
{
let increasing = [8, 9, 10];
let concated = concat_arrays!(
// the macro can't infer the length of runtime array non-literals.
increasing: [_; 3],
// most non-literal arguments need to be wrapped in `()` or `{}`.
([2u16, 3, 4].map(|x| x * 9)): [_; 3],
);
assert_eq!(concated, [8, 9, 10, 18, 27, 36]);
}
arrcat
is #![no_std]
, it can be used anywhere Rust can be used.
arrcat
requires Rust 1.57.0, requiring crate features to use newer language features.