Macro chain

Source
macro_rules! chain {
    ( $($types:ty),+ ) => { ... };
}
Expand description

Creates an object chain from the argument types.

This macro reduces the boilerplate required to describe the type of an object chain.

§Example:

Instead of writing this…

use embedded_layout::prelude::*;
use embedded_graphics::primitives::{Circle, Rectangle, Triangle};
type Views = Link<Rectangle, Link<Circle, Chain<Triangle>>>;

… the chain! macro allows you to write this:

use embedded_layout::prelude::*;
use embedded_graphics::primitives::{Circle, Rectangle, Triangle};
type Views = chain! { Triangle, Circle, Rectangle };

Note also how the order of types follows the type of objects in the chain instead of being reversed.