build: move the int/stream type mapping into a simdata module shared by the build script

This commit is contained in:
2025-12-24 09:59:12 +01:00
parent 2630c97609
commit 83e4614d10
5 changed files with 54 additions and 22 deletions

29
src/simdata.rs Normal file
View File

@@ -0,0 +1,29 @@
#[derive(Debug)]
pub enum StreamType {
IMU,
GPS,
Annotations
}
impl TryFrom<i8> for StreamType {
type Error = ();
fn try_from(value: i8) -> Result<Self, Self::Error> {
match value {
1 => Ok(StreamType::IMU),
2 => Ok(StreamType::GPS),
3 => Ok(StreamType::Annotations),
_ => Err(())
}
}
}
impl From<StreamType> for i8 {
fn from(value: StreamType) -> Self {
match value {
StreamType::IMU => 1,
StreamType::GPS => 2,
StreamType::Annotations => 3
}
}
}