1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
//! Array concatenation
//!
//! This crate allows concatenating multiple arrays of varying lengths into one array.
//!
//! # Example
//!
//! ### `concat_arrays`
//!
//! For more examples of using [`concat_arrays`],
//! you can [look here][concat_arrays_examples].
//!
//! ```rust
//! 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]);
//! }
//!
//! ```
//!
//! # No-std support
//!
//! `arrcat` is `#![no_std]`, it can be used anywhere Rust can be used.
//!
//! # Minimum Supported Rust Version
//!
//! `arrcat` requires Rust 1.57.0, requiring crate features to use newer language features.
//!
//!
//! [concat_arrays_examples]: crate::concat_arrays#examples
#![no_std]
#[cfg(test)]
mod tests;
mod internals;
#[macro_use]
mod macros;
#[doc(hidden)]
pub mod __ {
pub use core::{
compile_error, concat, marker::PhantomData, mem::ManuallyDrop, primitive::usize, stringify,
};
pub use crate::internals::*;
}
#[cfg(feature = "derive")]
#[doc = include_str!("../README.md")]
pub struct ReadmeTest;