Macro stylecs::style

source ·
macro_rules! style {
    () => { ... };
    ($($component:expr),+ $(,)?) => { ... };
}
Expand description

A shorthand for creating a Style type from a compile-time list of StyleComponent implementors.

Example Usage

use stylecs::{style, StyleComponent};

#[derive(StyleComponent, Debug, Clone, Eq, PartialEq)]
struct SomeComponent(u32);
#[derive(StyleComponent, Debug, Clone)]
struct AnotherComponent;

let style = style![SomeComponent(42), AnotherComponent];
assert_eq!(style.len(), 2);
assert_eq!(style.get::<SomeComponent>(), Some(&SomeComponent(42)));