Skip to main content

check_components

Macro check_components 

Source
check_components!() { /* proc-macro */ }
Expand description

The check_components! macro allows users to write compile-time tests to check for the correctness of component wiring for a CGP context.

§Example

Given the following:

check_components! {
    CanUsePerson for Person {
        GreeterComponent,
    }
}

The code above generates a check trait called CanUsePerson, which verifies whether the Person context implements the consumer trait for GreeterComponent (i.e., CanGreet):

trait CanUsePerson<Component, Params>: CanUseComponent<Component, Params> {}

impl CanUsePerson<GreeterComponent, ()> for Person {}