Various cleanup

Part of ongoing work to improve the performance of the command parser. These solve some of the issues that have gotten in the way. The set of changes was getting rather large so I want to get this in before I have to do the rebase dance and burden you all with more lines of code.

The flipping of the SystemState and State type's relationship from State having a SystemState member, to SystemState having a State (now SharedState) member. This allows for the following that wasn't allowed before:

pub struct SurferCommandParser;

impl SurferCommandParser {
   pub fn update(&mut self, state: &SharedState);
   // ...
}

The issue is that if SharedState has a ref to the SystemState, then the SurferCommandParser instance being held by SystemState will be borrowed both exclusively and shared and Rust is not happy. Inverting it means that subprograms can mutate themselves while taking the shared state separately.

Edited by Kaleb Barrett

Merge request reports

Loading