Macro generate_struct_arr

Source
macro_rules! generate_struct_arr {
    ($self:ident => $( $field:ident ),* $(,)? ) => { ... };
}
Expand description

Generates a list of tuples containing field names and their values

ยงExample

use testutils::generate_struct_arr;

struct BuildStd {
  std: bool,
  core: bool,
  alloc: bool,
}

let b = BuildStd {
  std: false,
  core: true,
  alloc: true,
};

let arr = generate_struct_arr![ b => core, alloc, std ];
assert_eq!(
  arr,
  [("core", true), ("alloc", true), ("std", false)]
);