#array #const #auto

macro auto-const-array

Define a const array without specify length

4 releases

0.2.1 Jul 11, 2023
0.2.0 Nov 22, 2022
0.1.1 Nov 22, 2022
0.1.0 Nov 22, 2022

#73 in #auto

Download history 587/week @ 2024-07-21 994/week @ 2024-07-28 1311/week @ 2024-08-04 1161/week @ 2024-08-11 1440/week @ 2024-08-18 1486/week @ 2024-08-25 1399/week @ 2024-09-01 1112/week @ 2024-09-08 1142/week @ 2024-09-15 1534/week @ 2024-09-22 1010/week @ 2024-09-29 1058/week @ 2024-10-06 1544/week @ 2024-10-13 1480/week @ 2024-10-20 2203/week @ 2024-10-27 2729/week @ 2024-11-03

8,102 downloads per month
Used in 36 crates (via monoio)

MIT/Apache

8KB
131 lines

Auto Const Array

Use this macro to declare a const array without specifing its length.

Crates.io MIT/Apache-2 licensed

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 compling.
    const ARRAY_WITH_ATTR: [u8; _] = [1, #[cfg(unix)] 2]
}

Dependencies

~235–680KB
~16K SLoC