write_const_array

Macro write_const_array 

Source
macro_rules! write_const_array {
    ($id:ident, $t:ty, $data:expr) => { ... };
    ($id:ident, $t:ty : 1, $data:expr) => { ... };
    ($id:ident, $t:ty : 2, $data:expr) => { ... };
    ($id:ident, $t:ty : 3, $data:expr) => { ... };
    ($id:ident, $t:ty : 4, $data:expr) => { ... };
    ($id:ident, $t:ty : 5, $data:expr) => { ... };
    ($id:ident, $t:ty : 6, $data:expr) => { ... };
    ($id:ident, $t:ty : 7, $data:expr) => { ... };
    ($id:ident, $t:ty : 8, $data:expr) => { ... };
    ($id:ident, $t:ty : 9, $data:expr) => { ... };
    ($id:ident, $t:ty : 10, $data:expr) => { ... };
    ($id:ident, $t:ty : 11, $data:expr) => { ... };
    ($id:ident, $t:ty : 12, $data:expr) => { ... };
    ($id:ident, $t:ty : 13, $data:expr) => { ... };
    ($id:ident, $t:ty : 14, $data:expr) => { ... };
    ($id:ident, $t:ty : 15, $data:expr) => { ... };
    ($id:ident, $t:ty : 16, $data:expr) => { ... };
}
Expand description

Write an array to a const context.

Makes the array, array reference, or array slice available for import into the main crate via use_symbols. Stack allocated types (such as slices and arrays) may be returned.

§Parameters

  • $id: the name/identifier to give the exported array
  • $t: the type of elements of the exported array will contain. Optionally followed by : DIM where DIM is the dimension (1, 2, 3, …) of the array. The dimension defaults to 1 when unspecified.
  • $data: the contents of the array. May be an array, an array reference, or array slice.

§Further notes

  • Must be called from a build script (build.rs) only.
  • If the array is large and referenced many times, this will lead to code bloat. In such a case, consider carefully whether write_static_array would be more appropriate instead.