diff --git a/src/lib.rs b/src/lib.rs index 9f6b40a..d8e7b84 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -236,6 +236,14 @@ impl VmcExtOk { } return Ok(VmcExtOk { loaded, calibration_state: None, calibration_mode: None, tracking_status: None}) } + fn new_vmc_message(loaded: i32, calibration_state: Option, calibration_mode: Option, tracking_status: Option) -> Result, MessageCreationErr> { + let msg = Self::new(loaded, calibration_state, calibration_mode, tracking_status); + if msg.is_ok() { + let boxed_result: Box = Box::new(msg.ok().unwrap()); + return Ok(boxed_result); + } + return Err(msg.err().unwrap()); + } } #[derive(Debug)] @@ -267,6 +275,20 @@ impl VmcMessage for VmcExtT { } } +impl VmcExtT { + fn new(time: f32) -> Result { + return Ok(VmcExtT { time }); + } + fn new_vmc_message(time: f32) -> Result, MessageCreationErr> { + let msg = Self::new(time); + if msg.is_ok() { + let boxed_result: Box = Box::new(msg.ok().unwrap()); + return Ok(boxed_result); + } + return Err(msg.err().unwrap()); + } +} + #[derive(Debug)] struct VmcExtRootPos { name: String,