create constructors for VmcMessageNoArgs
This commit is contained in:
parent
336f9435fb
commit
8a79d8c17f
14
src/lib.rs
14
src/lib.rs
|
@ -1976,7 +1976,7 @@ impl VmcExtSetConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct VmcMessageNoArgs {
|
pub struct VmcMessageNoArgs {
|
||||||
addr: String
|
addr: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1995,6 +1995,18 @@ impl VmcMessage for VmcMessageNoArgs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl VmcMessageNoArgs {
|
||||||
|
pub fn new(addr: String) ->MsgNewResult<Self> {
|
||||||
|
Ok(Self { addr })
|
||||||
|
}
|
||||||
|
pub fn new_vmc_message(addr: String) -> TraitMsgNewResult {
|
||||||
|
match Self::new(addr) {
|
||||||
|
Ok(val) => Ok(Box::new(val)),
|
||||||
|
Err(val) => Err(val),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn from_osc_message(msg: OscMessage) -> Result<Box<dyn VmcMessage>, FromMessageErr> {
|
pub fn from_osc_message(msg: OscMessage) -> Result<Box<dyn VmcMessage>, FromMessageErr> {
|
||||||
match msg.addr.as_str() {
|
match msg.addr.as_str() {
|
||||||
"/VMC/Ext/OK" => VmcExtOk::from_osc_message(msg),
|
"/VMC/Ext/OK" => VmcExtOk::from_osc_message(msg),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user