delegate_and_check_components

Macro delegate_and_check_components 

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

The delegate_and_check_components! macro combines both delegate_components! and check_components!, allowing both delegation and checks within a single macro call.

This is useful for the majority of simple cases, providing immediate feedback on whether the wiring works as intended.

§Example

Given the following code:

delegate_and_check_components! {
    CanUsePerson for Person;
    PersonComponents {
        GreeterComponent: GreetHello,
    }
}

is equivalent to writing the two separate macro calls:

delegate_components! {
    PersonComponents {
        GreeterComponent: GreetHello,
    }
}

check_components! {
    CanUsePerson for Person {
        GreeterComponent,
    }
}

In more advanced cases, it may still be necessary to call delegate_components! and check_components separately. This applies to cases where the CGP traits contain additional generic parameters, or when presets are used.