diff --git a/lib/common/src/instruction.rs b/lib/common/src/instruction.rs index d39b899..b2e2709 100644 --- a/lib/common/src/instruction.rs +++ b/lib/common/src/instruction.rs @@ -62,6 +62,7 @@ impl InstructionCollector pub const fn time(&self)->Time{ self.time } + #[inline] pub fn collect(&mut self,instruction:Option>){ if let Some(ins)=instruction{ if ins.time InstructionCollector } } } - pub fn instruction(self)->Option>{ + #[inline] + pub fn take(self)->Option>{ //STEAL INSTRUCTION AND DESTROY INSTRUCTIONCOLLECTOR self.instruction.map(|instruction|TimedInstruction{ time:self.time, diff --git a/strafe-client/src/physics.rs b/strafe-client/src/physics.rs index 9896e6b..29758ed 100644 --- a/strafe-client/src/physics.rs +++ b/strafe-client/src/physics.rs @@ -1111,7 +1111,7 @@ impl PhysicsData{ //this is the one who asks fn next_instruction_internal(state:&PhysicsState,data:&PhysicsData,time_limit:Time)->Option>{ //JUST POLLING!!! NO MUTATION - let mut collector = instruction::InstructionCollector::new(time_limit); + let mut collector=instruction::InstructionCollector::new(time_limit); collector.collect(state.next_move_instruction()); @@ -1145,7 +1145,7 @@ impl PhysicsData{ ) ); }); - collector.instruction() + collector.take() }