create constructors for VmcMessageNoArgs

This commit is contained in:
Cassandra de la Cruz-Munoz 2024-01-01 14:12:37 -05:00
parent 336f9435fb
commit 8a79d8c17f
Signed by: cassdlcm
GPG Key ID: BFEBACEA812DDA70

View File

@ -1976,7 +1976,7 @@ impl VmcExtSetConfig {
}
#[derive(Debug)]
struct VmcMessageNoArgs {
pub struct VmcMessageNoArgs {
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> {
match msg.addr.as_str() {
"/VMC/Ext/OK" => VmcExtOk::from_osc_message(msg),