Macro soa

Source
macro_rules! soa {
    () => { ... };
    ($x:expr $(,$xs:expr)* $(,)?) => { ... };
    ($elem:expr; 0) => { ... };
    ($elem:expr; 1) => { ... };
    ($elem:expr; $n:expr) => { ... };
}
Expand description

Creates a Soa containing the arguments.

soa! allows Soas to be defined with the same syntax as array expressions. There are two forms of this macro:

  • Create a Soa containing a given list of elements:
let soa = soa![Foo(1, 2), Foo(3, 4)];
assert_eq!(soa, soa![Foo(1, 2), Foo(3, 4)]);
  • Create a Soa from a given element and size:
let soa = soa![Foo(1, 2); 2];
assert_eq!(soa, soa![Foo(1, 2), Foo(1, 2)]);