add constructors for VmcExtT and VmcMessage contructor for VmcExtOk
This commit is contained in:
parent
8774ee8cae
commit
e385ffe5e9
22
src/lib.rs
22
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<i32>, calibration_mode: Option<i32>, tracking_status: Option<i32>) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
|
||||
let msg = Self::new(loaded, calibration_state, calibration_mode, tracking_status);
|
||||
if msg.is_ok() {
|
||||
let boxed_result: Box<dyn VmcMessage> = 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<Self, MessageCreationErr> {
|
||||
return Ok(VmcExtT { time });
|
||||
}
|
||||
fn new_vmc_message(time: f32) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
|
||||
let msg = Self::new(time);
|
||||
if msg.is_ok() {
|
||||
let boxed_result: Box<dyn VmcMessage> = Box::new(msg.ok().unwrap());
|
||||
return Ok(boxed_result);
|
||||
}
|
||||
return Err(msg.err().unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct VmcExtRootPos {
|
||||
name: String,
|
||||
|
|
Loading…
Reference in New Issue
Block a user