bolt
bolt copied to clipboard
[Feature] Change execute signature
Is your feature request related to a problem? Please describe. What if we could express this
#[system]
pub mod game_loop {
pub fn execute(ctx: Context<Components>, delta_time: f32) -> Result<Components> {
Ok(ctx.accounts)
}
#[system_input]
pub struct Components {
pub game_state: GameState,
}
}
as
#[system]
impl System for GameLoop {
fn execute(&self, game_state: &mut GameState, delta_time: f32) -> Result<()> {
let in_case_we_need_to_access_context = self.context();
Ok(())
}
}
This would make the code more Rusty and we could also benefit from having the ability to define mutability.
Important note:
Components are always borrowed
System Arguments are always moved