diff --git a/lib/common/src/instruction.rs b/lib/common/src/instruction.rs index 8aab3ca..6f78405 100644 --- a/lib/common/src/instruction.rs +++ b/lib/common/src/instruction.rs @@ -46,9 +46,7 @@ pub struct InstructionCollector<I,T>{ time:T, instruction:Option<I>, } -impl<I,T> InstructionCollector<I,T> - where T:Copy+PartialOrd, -{ +impl<I,T> InstructionCollector<I,T>{ #[inline] pub const fn new(time:T)->Self{ Self{ @@ -57,19 +55,6 @@ impl<I,T> InstructionCollector<I,T> } } #[inline] - pub const fn time(&self)->T{ - self.time - } - #[inline] - pub fn collect(&mut self,instruction:Option<TimedInstruction<I,T>>){ - if let Some(ins)=instruction{ - if ins.time<self.time{ - self.time=ins.time; - self.instruction=Some(ins.instruction); - } - } - } - #[inline] pub fn take(self)->Option<TimedInstruction<I,T>>{ //STEAL INSTRUCTION AND DESTROY INSTRUCTIONCOLLECTOR self.instruction.map(|instruction|TimedInstruction{ @@ -78,3 +63,20 @@ impl<I,T> InstructionCollector<I,T> }) } } +impl<I,T:Copy> InstructionCollector<I,T>{ + #[inline] + pub const fn time(&self)->T{ + self.time + } +} +impl<I,T:PartialOrd> InstructionCollector<I,T>{ + #[inline] + pub fn collect(&mut self,instruction:Option<TimedInstruction<I,T>>){ + if let Some(ins)=instruction{ + if ins.time<self.time{ + self.time=ins.time; + self.instruction=Some(ins.instruction); + } + } + } +}