TennyZhuang / auto-const-array

Declare a const array without specify its length

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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]
}

About

Declare a const array without specify its length

License:Apache License 2.0


Languages

Language:Rust 100.0%