removed #[repr(u8)] from many structs across the project, I found out that rust by default makes small structs u8s, it is uneeded to do it manually.

This commit is contained in:
2026-05-23 19:58:13 -05:00
parent a72efcfead
commit 450ea8da91
5 changed files with 48 additions and 42 deletions
+7 -21
View File
@@ -11,6 +11,8 @@ pub struct MotorDriverShaftSpeed {
}
impl MotorDriverShaftSpeed {
///This returns the current shaft speed as an RPM Value, which is the default for display.
/// It will be 0.0 if the data is none
pub fn speed_as_rpm(&self) -> f32 {
match self.shaft_speed {
Some(mut speed) => {
@@ -34,37 +36,21 @@ impl MotorDriverShaftSpeed {
impl Display for MotorDriverShaftSpeed {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.shaft_speed {
Some(speed) => {
let unit = match self.unit {
Unit::Radians => "rad",
Unit::Rotations => "R",
_ => "",
};
write!(f, "")
}
None => {write!(f, "No Given Speeds")}
}
write!(f, "Motor Shaft Speed: {}", self.speed_as_rpm())
}
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[repr(u8)]
pub enum Unit {
Unknown = 0,
Rotations = 1,
Radians = 2,
Rotations,
Radians,
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
#[repr(u8)]
pub enum TimeScale {
Unknown = 0,
PerSecond = 1,
PerMinute = 2,
PerSecond,
PerMinute,
}