create constructors for VmcThru

This commit is contained in:
Cassandra de la Cruz-Munoz 2024-01-01 13:56:55 -05:00
parent d3a44717a9
commit 3a55079212
Signed by: cassdlcm
GPG Key ID: BFEBACEA812DDA70

View File

@ -1664,13 +1664,13 @@ impl VmcExtConfig {
}
#[derive(Clone, Copy, Debug)]
enum ThruType {
pub enum ThruType {
Float(f32),
Int(i32),
}
#[derive(Debug)]
struct VmcThru {
pub struct VmcThru {
addr: String,
arg1: String,
arg2: Option<ThruType>
@ -1712,6 +1712,18 @@ impl VmcMessage for VmcThru {
}
}
impl VmcThru {
pub fn new(addr: String, arg1: String, arg2: Option<ThruType>) ->MsgNewResult<Self> {
Ok(Self { addr, arg1, arg2})
}
pub fn new_vmc_message(addr: String, arg1: String, arg2: Option<ThruType>) ->TraitMsgNewResult {
match Self::new(addr, arg1, arg2) {
Ok(val) => Ok(Box::new(val)),
Err(val) => Err(val),
}
}
}
#[derive(Debug)]
struct VmcExtSetPeriod {
status: i32,