add VmcExtOpt
This commit is contained in:
parent
00db538216
commit
c274f7925b
26
src/lib.rs
26
src/lib.rs
|
@ -1003,3 +1003,29 @@ impl MessageBehavior for VmcExtRemote {
|
|||
return Ok(VmcExtRemote { service, json });
|
||||
}
|
||||
}
|
||||
|
||||
struct VmcExtOpt {
|
||||
option: String,
|
||||
}
|
||||
|
||||
impl MessageBehavior for VmcExtOpt {
|
||||
fn to_osc_message(&self) -> OscMessage {
|
||||
return OscMessage {
|
||||
addr: String::from("/VMC/Ext/Opt"),
|
||||
args: vec![OscType::from(self.option.to_owned())],
|
||||
};
|
||||
}
|
||||
fn from_osc_message(msg: OscMessage) -> Result<Self, String> {
|
||||
if msg.args.len() != 1 {
|
||||
return Err(String::from("arg count invalid"));
|
||||
}
|
||||
match &msg.args[0] {
|
||||
OscType::String(s) => {
|
||||
return Ok(VmcExtOpt {
|
||||
option: s.to_owned(),
|
||||
})
|
||||
}
|
||||
_ => return Err(String::from("arg type invalid")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user