pub struct TimedInstruction { pub time: crate::body::TIME, pub instruction: I, } pub trait InstructionEmitter { fn next_instruction(&self) -> Option>; } pub trait InstructionConsumer { fn process_instruction(&mut self, instruction:TimedInstruction); } //PROPER PRIVATE FIELDS!!! pub struct InstructionCollector { instruction: Option>, } impl InstructionCollector { pub fn new() -> Self { Self{instruction:None} } pub fn collect(&mut self,instruction:Option>){ match &instruction { Some(unwrap_instruction) => match &self.instruction { Some(unwrap_best_instruction) => if unwrap_instruction.time self.instruction=instruction, }, None => (), } } pub fn instruction(self) -> Option> { //STEAL INSTRUCTION AND DESTROY INSTRUCTIONCOLLECTOR return self.instruction } }