Skip to main content

System

Derive Macro System 

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

Derive macro for System trait

Auto-generates the boilerplate System trait implementation. Requires #[system(name = “system_name”)] attribute.

§Example

ⓘ
use crate::system::System; // or use issun::system::System;

#[derive(System)]
#[system(name = "combat_engine")]
pub struct CombatSystem {
    turn_count: u32,
    log: Vec<String>,
}

This generates:

  • name() method returning the specified system name
  • as_any() and as_any_mut() for downcasting
  • async_trait wrapper

Note: You must have System trait in scope via use statement.