add VmcExtConfig
This commit is contained in:
parent
dbb208dfc4
commit
a98faa2319
22
src/lib.rs
22
src/lib.rs
|
@ -1141,3 +1141,25 @@ impl MessageBehavior for VmcExtSettingWin {
|
|||
return Ok(result);
|
||||
}
|
||||
}
|
||||
|
||||
struct VmcExtConfig {
|
||||
path: String,
|
||||
}
|
||||
|
||||
impl MessageBehavior for VmcExtConfig {
|
||||
fn to_osc_message(&self) -> OscMessage {
|
||||
return OscMessage {
|
||||
addr: String::from("/VMC/Ext/Config"),
|
||||
args: vec![OscType::from(self.path.to_owned())],
|
||||
};
|
||||
}
|
||||
fn from_osc_message(msg: OscMessage) -> Result<Self, String> {
|
||||
if msg.addr.len() != 1 {
|
||||
return Err(String::from("arg count invalid"));
|
||||
}
|
||||
match &msg.args[0] {
|
||||
OscType::String(s) => return Ok(VmcExtConfig { path: s.to_owned() }),
|
||||
_ => return Err(String::from("arg type invalid")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user