From 7bff8bca2864dfd951d455ed6e780910f7cc478f Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 18 Oct 2023 21:01:00 -0700 Subject: [PATCH] rustge --- src/physics.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/physics.rs b/src/physics.rs index 57b3cc5..bad5bfe 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -73,20 +73,11 @@ impl InputInstruction{ |crate::physics::InputInstruction::Reset |crate::physics::InputInstruction::Idle=>0u32, }; - let id=match self{ - crate::physics::InputInstruction::MoveRight(_)=>0, - crate::physics::InputInstruction::MoveUp(_)=>1, - crate::physics::InputInstruction::MoveBack(_)=>2, - crate::physics::InputInstruction::MoveLeft(_)=>3, - crate::physics::InputInstruction::MoveDown(_)=>4, - crate::physics::InputInstruction::MoveForward(_)=>5, - crate::physics::InputInstruction::Jump(_)=>6, - crate::physics::InputInstruction::Zoom(_)=>7, - crate::physics::InputInstruction::MoveMouse(_)=>8, - crate::physics::InputInstruction::Reset=>9, - crate::physics::InputInstruction::Idle=>10, - }; - id|parity + self.discriminant()|parity + } + pub fn discriminant(&self)->u32{ + //from documentation for std::mem::discriminant(&self) + unsafe{*<*const _>::from(self).cast::()} } }