Skip to main content

ProbarComponent

Derive Macro ProbarComponent 

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

Derive macro for type-safe component inspection.

Generates the ProbarComponent trait implementation which provides:

  • component_name() - Returns the canonical string name
  • component_type_id() - Returns a unique type identifier
  • field_names() - Returns field names for inspection
  • from_bytes() - Deserialize from WASM memory (zero-copy where possible)

§Attributes

  • #[probar(name = "custom_name")] - Override the component name
  • #[probar(skip)] - Skip a field from inspection

§Example

#[derive(ProbarComponent)]
struct Position {
    x: f32,
    y: f32,
    #[probar(skip)]
    _internal: u32,
}

// Now usable as:
let pos: Position = game.component::<Position>(entity)?;