auto_const_array!() { /* proc-macro */ }
Expand description

Declare a new const array without specify length. It helps when apply conditional compilation to part of a const array.

Syntax

The macro wraps any number of const array declarations(with length _).

use auto_const_array::auto_const_array;
auto_const_array! {
   // Additional attributes and docs are supported.
   /// Common array with public visibility.
   #[allow(unused)]
   pub const ARRAY_COMMON: [u8; _] = [1, 2, 4];
   /// Special array with cfg conditional compiling.
   const ARRAY_WITH_ATTR: [u8; _] = [1, #[cfg(unix)] 2]
}