Skip to main content

ProbarEntity

Trait ProbarEntity 

Source
pub trait ProbarEntity: Copy {
    // Required methods
    fn entity_id(&self) -> EntityId;
    fn entity_name(&self) -> &'static str;
}
Expand description

Trait for type-safe entity selectors (Poka-Yoke pattern)

This trait is implemented by #[derive(ProbarEntities)] macro to provide compile-time verified entity access.

§Example

// Generated by probar-derive
#[derive(ProbarEntities)]
pub struct PongGame {
    pub player1_paddle: Entity,
    pub player2_paddle: Entity,
    pub ball: Entity,
}

// In tests - compile-time verified!
let paddle = game.entity(PongGame::Player1Paddle);

Required Methods§

Source

fn entity_id(&self) -> EntityId

Get the entity ID for this selector

Source

fn entity_name(&self) -> &'static str

Get the entity name for debugging

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§