diff --git a/lib/common/src/instruction.rs b/lib/common/src/instruction.rs index 3b71db9..867ab7f 100644 --- a/lib/common/src/instruction.rs +++ b/lib/common/src/instruction.rs @@ -6,6 +6,7 @@ pub struct TimedInstruction{ pub instruction:I, } impl TimedInstruction{ + #[inline] pub fn set_time(self,new_time:Time)->TimedInstruction{ TimedInstruction{ time:new_time, @@ -29,6 +30,7 @@ pub trait InstructionFeedback:InstructionEmitter+Instruction where Time:Copy, { + #[inline] fn process_exhaustive(&mut self,time_limit:Time){ while let Some(instruction)=self.next_instruction(time_limit){ self.process_instruction(instruction); @@ -49,6 +51,7 @@ pub struct InstructionCollector{ impl InstructionCollector where Time:Copy+PartialOrd, { + #[inline] pub const fn new(time:Time)->Self{ Self{ time, @@ -60,24 +63,18 @@ impl InstructionCollector self.time } pub fn collect(&mut self,instruction:Option>){ - match instruction{ - Some(unwrap_instruction)=>{ - if unwrap_instruction.time(), + if let Some(ins)=instruction{ + if ins.timeOption>{ //STEAL INSTRUCTION AND DESTROY INSTRUCTIONCOLLECTOR - match self.instruction{ - Some(instruction)=>Some(TimedInstruction{ - time:self.time, - instruction - }), - None=>None, - } + self.instruction.map(|instruction|TimedInstruction{ + time:self.time, + instruction + }) } }