RKTK API Docs RKTK Home Repo

Macro layout2d

Source
macro_rules! layout2d {
    ($(#[$attr:meta])* $vis:vis $name:ident, [$($shape:expr),* $(,)?]) => { ... };
}
Expand description

Creates a two-dimensional LED layout from a collection of shapes.

§Arguments

  • #[$attr] - Optional attributes to apply to the struct (e.g., #[derive(Debug)])
  • $vis - Optional visibility modifier (e.g., pub)
  • $name - The name of the layout type to create
  • [$($shape:expr),*] - A list of Shape2d instances defining the layout

§Output

Macro output will be a type definition that implements Layout2d.

§Example

use blinksy::{layout2d, layout::Shape2d, layout::Vec2};

layout2d!(
    Layout,
    [Shape2d::Grid {
        start: Vec2::new(-1., -1.),
        horizontal_end: Vec2::new(1., -1.),
        vertical_end: Vec2::new(-1., 1.),
        horizontal_pixel_count: 16,
        vertical_pixel_count: 16,
        serpentine: true,
    }]
);