#items #attributes #across #multiple #macro #splatters #attribs

macro splat_attribs

Simple macro that splatters attributes across multiple items

1 stable release

new 1.0.0 Jan 19, 2025

#419 in Procedural macros


Used in newnum

MIT license

4KB

Simple rust macro that splatters attributes across multiple items.

Syntax

splat_attribs! {
  ~attributes~:
  ~items~
}

Example

use splat_attribs::splat_attribs;

fn main() {
  println!("{Casiopea} < {TSquare} < {Dimension}")
}

splat_attribs! {
  #[allow(non_upper_case_globals)]
  #[doc = "Applied to all items"]:

  const Casiopea: u32 = 10 / 10;
  const TSquare: u32 = 11 / 10;
  const Dimension: u32 = u32::MAX / 10;
}

Dependencies

~230–680KB
~16K SLoC