create constructors for VmcThru
This commit is contained in:
parent
d3a44717a9
commit
3a55079212
16
src/lib.rs
16
src/lib.rs
|
@ -1664,13 +1664,13 @@ impl VmcExtConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
enum ThruType {
|
pub enum ThruType {
|
||||||
Float(f32),
|
Float(f32),
|
||||||
Int(i32),
|
Int(i32),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct VmcThru {
|
pub struct VmcThru {
|
||||||
addr: String,
|
addr: String,
|
||||||
arg1: String,
|
arg1: String,
|
||||||
arg2: Option<ThruType>
|
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)]
|
#[derive(Debug)]
|
||||||
struct VmcExtSetPeriod {
|
struct VmcExtSetPeriod {
|
||||||
status: i32,
|
status: i32,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user