#[derive(Debug)] pub struct TimedInstruction { pub time: crate::physics::TIME, pub instruction: I, } pub trait InstructionEmitter { fn next_instruction(&self, time_limit:crate::physics::TIME) -> Option>; } pub trait InstructionConsumer { fn process_instruction(&mut self, instruction:TimedInstruction); } //PROPER PRIVATE FIELDS!!! pub struct InstructionCollector { time: crate::physics::TIME, instruction: Option, } impl InstructionCollector { pub fn new(time:crate::physics::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, } } }