use std::{collections::HashMap, hash::Hash}; #[derive(Debug)] pub struct Axis { axis_data: HashMap, } impl Default for Axis where T: Copy + Eq + Hash, { fn default() -> Self { Axis { axis_data: HashMap::new(), } } } impl Axis where T: Copy + Eq + Hash, { pub fn set(&mut self, axis: T, value: f32) -> Option { self.axis_data.insert(axis, value) } pub fn get(&self, axis: T) -> Option { self.axis_data.get(&axis).copied() } pub fn remove(&mut self, axis: T) -> Option { self.axis_data.remove(&axis) } }