#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

#1363 in Procedural macros

Download history 362/week @ 2023-12-15 414/week @ 2023-12-22 450/week @ 2023-12-29 630/week @ 2024-01-05 408/week @ 2024-01-12 693/week @ 2024-01-19 1148/week @ 2024-01-26 1769/week @ 2024-02-02 631/week @ 2024-02-09 1222/week @ 2024-02-16 639/week @ 2024-02-23 634/week @ 2024-03-01 606/week @ 2024-03-08 658/week @ 2024-03-15 1182/week @ 2024-03-22 982/week @ 2024-03-29

3,507 downloads per month
Used in 21 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

~330–780KB
~19K SLoC