macro_rules! implement_has_component {
    ($type: path {
        $( $field: ident: $component: path ),+ $(,)?
    }) => { ... };
}
Expand description

This macro is for implementing the HasComponent trait in the special (but common) case when the state is a struct and the component is a direct field of the struct.

Examples

Implementing a single component:

struct MyState {
    component: library_1::Component,
}

impl TexlangState for MyState {}

implement_has_component![MyState{
    component: library_1::Component,
}];

Implementing multiple components:

struct MyState {
    component_1: library_1::Component,
    component_2: library_2::Component,
}

impl TexlangState for MyState {}

implement_has_component![MyState{
    component_1: library_1::Component,
    component_2: library_2::Component,
}];