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