Skip to main content

ProbarSelector

Derive Macro ProbarSelector 

Source
#[derive(ProbarSelector)]
{
    // Attributes available to this derive:
    #[probar]
}
Expand description

Derive macro for generating type-safe selector enums.

This macro generates an enum with all available entities and components, providing compile-time exhaustiveness checking for test coverage.

§Attributes

  • #[probar(entities = [Entity1, Entity2, ...])] - List of entity types
  • #[probar(components = [Comp1, Comp2, ...])] - List of component types

§Generated Code

#[derive(ProbarSelector)]
#[probar(entities = [Player, Enemy])]
#[probar(components = [Position, Health])]
struct GameSelectors;

// Generates:
// - GameSelectorsEntity enum with Player, Enemy variants
// - GameSelectorsComponent enum with Position, Health variants
// - Conversion traits for type-safe queries