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