custom message parsing errors #1

Merged
cassdlcm merged 22 commits from custom_errors into main 2023-12-31 19:36:26 +01:00
Showing only changes of commit 78a03b862d - Show all commits

View File

@ -18,7 +18,7 @@ struct ArgCountErr {
} }
struct ArgTypeErr { struct ArgTypeErr {
expected: OscType, expected: Vec<OscType>,
actual: OscType, actual: OscType,
addr: String, addr: String,
arg_count: usize, arg_count: usize,
@ -89,7 +89,7 @@ impl MessageBehavior for VmcExtOk {
result.loaded = i; result.loaded = i;
} }
_ => { _ => {
return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[0],addr: msg.addr.to_owned(), arg_count: 0})); return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[0],addr: msg.addr.to_owned(), arg_count: 0}));
} }
} }
} else { } else {
@ -101,7 +101,7 @@ impl MessageBehavior for VmcExtOk {
result.calibration_state = Some(i); result.calibration_state = Some(i);
} }
_ => { _ => {
return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[1], addr: msg.addr.to_owned(), arg_count: 1})); return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[1], addr: msg.addr.to_owned(), arg_count: 1}));
} }
} }
match msg.args[2] { match msg.args[2] {
@ -109,7 +109,7 @@ impl MessageBehavior for VmcExtOk {
result.calibration_mode = Some(i); result.calibration_mode = Some(i);
} }
_ => { _ => {
return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[2], addr: msg.addr.to_owned(), arg_count: 2})); return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[2], addr: msg.addr.to_owned(), arg_count: 2}));
} }
} }
} }
@ -119,7 +119,7 @@ impl MessageBehavior for VmcExtOk {
result.tracking_status = Some(i); result.tracking_status = Some(i);
} }
_ => { _ => {
return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[3], addr: msg.addr.to_owned(), arg_count: 3})); return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[3], addr: msg.addr.to_owned(), arg_count: 3}));
} }
} }
} }
@ -144,7 +144,7 @@ impl MessageBehavior for VmcExtT {
} }
match msg.args[0] { match msg.args[0] {
OscType::Float(f) => return Ok(VmcExtT { time: f }), OscType::Float(f) => return Ok(VmcExtT { time: f }),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
} }
} }
@ -189,19 +189,19 @@ impl MessageBehavior for VmcExtRootPos {
let name: String; let name: String;
match &msg.args[0] { match &msg.args[0] {
OscType::String(s) => name = s.to_owned(), OscType::String(s) => name = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match msg.args[1] { match msg.args[1] {
OscType::Float(f) => origin.x = f, OscType::Float(f) => origin.x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
match msg.args[2] { match msg.args[2] {
OscType::Float(f) => origin.y = f, OscType::Float(f) => origin.y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[2], addr: msg.addr, arg_count: 2})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[2], addr: msg.addr, arg_count: 2})),
} }
match msg.args[3] { match msg.args[3] {
OscType::Float(f) => origin.z = f, OscType::Float(f) => origin.z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[3], addr: msg.addr, arg_count: 3})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[3], addr: msg.addr, arg_count: 3})),
} }
let mut quat = Quaternion { let mut quat = Quaternion {
x: 0.0, x: 0.0,
@ -211,19 +211,19 @@ impl MessageBehavior for VmcExtRootPos {
}; };
match msg.args[4] { match msg.args[4] {
OscType::Float(f) => quat.x = f, OscType::Float(f) => quat.x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[4], addr: msg.addr, arg_count: 4})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[4], addr: msg.addr, arg_count: 4})),
} }
match msg.args[5] { match msg.args[5] {
OscType::Float(f) => quat.y = f, OscType::Float(f) => quat.y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[5], addr: msg.addr, arg_count: 5})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[5], addr: msg.addr, arg_count: 5})),
} }
match msg.args[6] { match msg.args[6] {
OscType::Float(f) => quat.z = f, OscType::Float(f) => quat.z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[6], addr: msg.addr, arg_count: 6})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[6], addr: msg.addr, arg_count: 6})),
} }
match msg.args[7] { match msg.args[7] {
OscType::Float(f) => quat.w = f, OscType::Float(f) => quat.w = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[7], addr: msg.addr, arg_count: 7})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[7], addr: msg.addr, arg_count: 7})),
} }
result = VmcExtRootPos { result = VmcExtRootPos {
name, name,
@ -247,27 +247,27 @@ impl MessageBehavior for VmcExtRootPos {
}); });
match msg.args[8] { match msg.args[8] {
OscType::Float(f) => result.mr_scale.unwrap().x = f, OscType::Float(f) => result.mr_scale.unwrap().x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[8], addr: msg.addr, arg_count: 8})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[8], addr: msg.addr, arg_count: 8})),
} }
match msg.args[9] { match msg.args[9] {
OscType::Float(f) => result.mr_scale.unwrap().y = f, OscType::Float(f) => result.mr_scale.unwrap().y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[9], addr: msg.addr, arg_count: 9})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[9], addr: msg.addr, arg_count: 9})),
} }
match msg.args[10] { match msg.args[10] {
OscType::Float(f) => result.mr_scale.unwrap().z = f, OscType::Float(f) => result.mr_scale.unwrap().z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[10], addr: msg.addr, arg_count: 10})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[10], addr: msg.addr, arg_count: 10})),
} }
match msg.args[11] { match msg.args[11] {
OscType::Float(f) => result.mr_offset.unwrap().x = f, OscType::Float(f) => result.mr_offset.unwrap().x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[11], addr: msg.addr, arg_count: 11})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[11], addr: msg.addr, arg_count: 11})),
} }
match msg.args[12] { match msg.args[12] {
OscType::Float(f) => result.mr_offset.unwrap().y = f, OscType::Float(f) => result.mr_offset.unwrap().y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[12], addr: msg.addr, arg_count: 12})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[12], addr: msg.addr, arg_count: 12})),
} }
match msg.args[13] { match msg.args[13] {
OscType::Float(f) => result.mr_offset.unwrap().z = f, OscType::Float(f) => result.mr_offset.unwrap().z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[13], addr: msg.addr, arg_count: 13})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[13], addr: msg.addr, arg_count: 13})),
} }
} }
return Ok(result); return Ok(result);
@ -304,19 +304,19 @@ impl MessageBehavior for VmcExtBonePos {
} }
match &msg.args[0] { match &msg.args[0] {
OscType::String(s) => name = s.to_owned(), OscType::String(s) => name = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match msg.args[1] { match msg.args[1] {
OscType::Float(f) => origin.x = f, OscType::Float(f) => origin.x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
match msg.args[2] { match msg.args[2] {
OscType::Float(f) => origin.y = f, OscType::Float(f) => origin.y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[2], addr: msg.addr, arg_count: 2})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[2], addr: msg.addr, arg_count: 2})),
} }
match msg.args[3] { match msg.args[3] {
OscType::Float(f) => origin.z = f, OscType::Float(f) => origin.z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[3], addr: msg.addr, arg_count: 3})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[3], addr: msg.addr, arg_count: 3})),
} }
let mut quat = Quaternion { let mut quat = Quaternion {
x: 0.0, x: 0.0,
@ -326,19 +326,19 @@ impl MessageBehavior for VmcExtBonePos {
}; };
match msg.args[4] { match msg.args[4] {
OscType::Float(f) => quat.x = f, OscType::Float(f) => quat.x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[4], addr: msg.addr, arg_count: 4})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[4], addr: msg.addr, arg_count: 4})),
} }
match msg.args[5] { match msg.args[5] {
OscType::Float(f) => quat.y = f, OscType::Float(f) => quat.y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[5], addr: msg.addr, arg_count: 5})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[5], addr: msg.addr, arg_count: 5})),
} }
match msg.args[6] { match msg.args[6] {
OscType::Float(f) => quat.z = f, OscType::Float(f) => quat.z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[6], addr: msg.addr, arg_count: 6})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[6], addr: msg.addr, arg_count: 6})),
} }
match msg.args[7] { match msg.args[7] {
OscType::Float(f) => quat.w = f, OscType::Float(f) => quat.w = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[7], addr: msg.addr, arg_count: 7})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[7], addr: msg.addr, arg_count: 7})),
} }
return Ok(VmcExtBonePos { return Ok(VmcExtBonePos {
name, name,
@ -370,11 +370,11 @@ impl MessageBehavior for VmcExtBlendVal {
} }
match &msg.args[0] { match &msg.args[0] {
OscType::String(s) => name = s.to_owned(), OscType::String(s) => name = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match msg.args[1] { match msg.args[1] {
OscType::Float(f) => value = f, OscType::Float(f) => value = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
return Ok(VmcExtBlendVal { name, value }); return Ok(VmcExtBlendVal { name, value });
} }
@ -414,39 +414,39 @@ impl MessageBehavior for VmcExtCam {
let fov: f32; let fov: f32;
match &msg.args[0] { match &msg.args[0] {
OscType::String(s) => name = s.to_owned(), OscType::String(s) => name = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match msg.args[1] { match msg.args[1] {
OscType::Float(f) => origin.x = f, OscType::Float(f) => origin.x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
match msg.args[2] { match msg.args[2] {
OscType::Float(f) => origin.y = f, OscType::Float(f) => origin.y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[2], addr: msg.addr, arg_count: 2})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[2], addr: msg.addr, arg_count: 2})),
} }
match msg.args[3] { match msg.args[3] {
OscType::Float(f) => origin.z = f, OscType::Float(f) => origin.z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[3], addr: msg.addr, arg_count: 3})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[3], addr: msg.addr, arg_count: 3})),
} }
match msg.args[4] { match msg.args[4] {
OscType::Float(f) => quat.x = f, OscType::Float(f) => quat.x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[4], addr: msg.addr, arg_count: 4})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[4], addr: msg.addr, arg_count: 4})),
} }
match msg.args[5] { match msg.args[5] {
OscType::Float(f) => quat.y = f, OscType::Float(f) => quat.y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[5], addr: msg.addr, arg_count: 5})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[5], addr: msg.addr, arg_count: 5})),
} }
match msg.args[6] { match msg.args[6] {
OscType::Float(f) => quat.z = f, OscType::Float(f) => quat.z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[6], addr: msg.addr, arg_count: 6})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[6], addr: msg.addr, arg_count: 6})),
} }
match msg.args[7] { match msg.args[7] {
OscType::Float(f) => quat.w = f, OscType::Float(f) => quat.w = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[7], addr: msg.addr, arg_count: 7})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[7], addr: msg.addr, arg_count: 7})),
} }
match msg.args[8] { match msg.args[8] {
OscType::Float(f) => fov = f, OscType::Float(f) => fov = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[8], addr: msg.addr, arg_count: 8})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[8], addr: msg.addr, arg_count: 8})),
} }
return Ok(VmcExtCam { return Ok(VmcExtCam {
name, name,
@ -490,40 +490,40 @@ impl MessageBehavior for VmcExtCon {
let mut axis = Vector3::new(0.0, 0.0, 0.0); let mut axis = Vector3::new(0.0, 0.0, 0.0);
match msg.args[0] { match msg.args[0] {
OscType::Int(i) => active = i, OscType::Int(i) => active = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
if active > 2 || active < 0 { if active > 2 || active < 0 {
return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 2, actual: active, addr: msg.addr, arg_count: 0})); return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 2, actual: active, addr: msg.addr, arg_count: 0}));
} }
match &msg.args[1] { match &msg.args[1] {
OscType::String(s) => name = s.to_owned(), OscType::String(s) => name = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
match msg.args[2] { match msg.args[2] {
OscType::Int(i) => is_left = i, OscType::Int(i) => is_left = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[2], addr: msg.addr, arg_count: 2})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[2], addr: msg.addr, arg_count: 2})),
} }
if is_left < 0 || is_left > 1 { if is_left < 0 || is_left > 1 {
return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: active, addr: msg.addr, arg_count: 2})); return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: active, addr: msg.addr, arg_count: 2}));
} }
match msg.args[3] { match msg.args[3] {
OscType::Int(i) => is_touch = i, OscType::Int(i) => is_touch = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[3], addr: msg.addr, arg_count: 3})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[3], addr: msg.addr, arg_count: 3})),
} }
if is_touch < 0 || is_touch > 1 { if is_touch < 0 || is_touch > 1 {
return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: active, addr: msg.addr, arg_count: 3})); return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: active, addr: msg.addr, arg_count: 3}));
} }
match msg.args[4] { match msg.args[4] {
OscType::Float(f) => axis.x = f, OscType::Float(f) => axis.x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[4], addr: msg.addr, arg_count: 4})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[4], addr: msg.addr, arg_count: 4})),
} }
match msg.args[5] { match msg.args[5] {
OscType::Float(f) => axis.y = f, OscType::Float(f) => axis.y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[5], addr: msg.addr, arg_count: 5})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[5], addr: msg.addr, arg_count: 5})),
} }
match msg.args[6] { match msg.args[6] {
OscType::Float(f) => axis.z = f, OscType::Float(f) => axis.z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[6], addr: msg.addr, arg_count: 6})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[6], addr: msg.addr, arg_count: 6})),
} }
return Ok(VmcExtCon { return Ok(VmcExtCon {
active, active,
@ -575,15 +575,15 @@ impl MessageBehavior for VmcExtKey {
return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: i, addr: msg.addr, arg_count: 0})); return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: i, addr: msg.addr, arg_count: 0}));
} }
} }
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match &msg.args[1] { match &msg.args[1] {
OscType::String(s) => name = s.to_owned(), OscType::String(s) => name = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
match msg.args[2] { match msg.args[2] {
OscType::Int(i) => keycode = i, OscType::Int(i) => keycode = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[2], addr: msg.addr, arg_count: 2})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[2], addr: msg.addr, arg_count: 2})),
} }
return Ok(VmcExtKey { return Ok(VmcExtKey {
active, active,
@ -636,19 +636,19 @@ impl MessageBehavior for VmcExtMidiNote {
return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: i, addr: msg.addr, arg_count: 0})); return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: i, addr: msg.addr, arg_count: 0}));
} }
} }
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match msg.args[1] { match msg.args[1] {
OscType::Int(i) => channel = i, OscType::Int(i) => channel = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
match msg.args[2] { match msg.args[2] {
OscType::Int(i) => note = i, OscType::Int(i) => note = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[2], addr: msg.addr, arg_count: 2})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[2], addr: msg.addr, arg_count: 2})),
} }
match msg.args[3] { match msg.args[3] {
OscType::Float(f) => velocity = f, OscType::Float(f) => velocity = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[3], addr: msg.addr, arg_count: 3})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[3], addr: msg.addr, arg_count: 3})),
} }
return Ok(VmcExtMidiNote { return Ok(VmcExtMidiNote {
active, active,
@ -679,11 +679,11 @@ impl MessageBehavior for VmcExtMidiCcVal {
let value: f32; let value: f32;
match msg.args[0] { match msg.args[0] {
OscType::Int(i) => knob = i, OscType::Int(i) => knob = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match msg.args[1] { match msg.args[1] {
OscType::Float(f) => value = f, OscType::Float(f) => value = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
return Ok(VmcExtMidiCcVal { knob, value }); return Ok(VmcExtMidiCcVal { knob, value });
} }
@ -715,7 +715,7 @@ impl MessageBehavior for VmcExtMidiCcBit {
let active: bool; let active: bool;
match msg.args[0] { match msg.args[0] {
OscType::Int(i) => knob = i, OscType::Int(i) => knob = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match msg.args[1] { match msg.args[1] {
OscType::Int(i) => { OscType::Int(i) => {
@ -727,7 +727,7 @@ impl MessageBehavior for VmcExtMidiCcBit {
return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: i, addr: msg.addr, arg_count: 1})); return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: i, addr: msg.addr, arg_count: 1}));
} }
} }
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
return Ok(VmcExtMidiCcBit { knob, active }); return Ok(VmcExtMidiCcBit { knob, active });
} }
@ -765,35 +765,35 @@ impl MessageBehavior for DeviceTranform {
let mut quat = Quaternion::new(0.0, 0.0, 0.0, 0.0); let mut quat = Quaternion::new(0.0, 0.0, 0.0, 0.0);
match &msg.args[0] { match &msg.args[0] {
OscType::String(s) => serial = s.to_owned(), OscType::String(s) => serial = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match msg.args[1] { match msg.args[1] {
OscType::Float(f) => origin.x = f, OscType::Float(f) => origin.x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
match msg.args[2] { match msg.args[2] {
OscType::Float(f) => origin.y = f, OscType::Float(f) => origin.y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[2], addr: msg.addr, arg_count: 2})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[2], addr: msg.addr, arg_count: 2})),
} }
match msg.args[3] { match msg.args[3] {
OscType::Float(f) => origin.z = f, OscType::Float(f) => origin.z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[3], addr: msg.addr, arg_count: 3})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[3], addr: msg.addr, arg_count: 3})),
} }
match msg.args[4] { match msg.args[4] {
OscType::Float(f) => quat.x = f, OscType::Float(f) => quat.x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[4], addr: msg.addr, arg_count: 4})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[4], addr: msg.addr, arg_count: 4})),
} }
match msg.args[5] { match msg.args[5] {
OscType::Float(f) => quat.y = f, OscType::Float(f) => quat.y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[5], addr: msg.addr, arg_count: 5})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[5], addr: msg.addr, arg_count: 5})),
} }
match msg.args[6] { match msg.args[6] {
OscType::Float(f) => quat.z = f, OscType::Float(f) => quat.z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[6], addr: msg.addr, arg_count: 6})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[6], addr: msg.addr, arg_count: 6})),
} }
match msg.args[7] { match msg.args[7] {
OscType::Float(f) => quat.w = f, OscType::Float(f) => quat.w = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[7], addr: msg.addr, arg_count: 7})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[7], addr: msg.addr, arg_count: 7})),
} }
return Ok(DeviceTranform { return Ok(DeviceTranform {
addr: msg.addr.to_owned(), addr: msg.addr.to_owned(),
@ -843,7 +843,7 @@ impl MessageBehavior for VmcExtRvc {
return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: i, addr: msg.addr, arg_count: 0})); return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: i, addr: msg.addr, arg_count: 0}));
} }
} }
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match msg.args[1] { match msg.args[1] {
OscType::Int(i) => { OscType::Int(i) => {
@ -853,12 +853,12 @@ impl MessageBehavior for VmcExtRvc {
return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 65535, actual: i, addr: msg.addr, arg_count: 1})); return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 65535, actual: i, addr: msg.addr, arg_count: 1}));
} }
} }
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
if msg.args.len() == 3 { if msg.args.len() == 3 {
match &msg.args[2] { match &msg.args[2] {
OscType::String(s) => ip_addr = Some(s.to_owned()), OscType::String(s) => ip_addr = Some(s.to_owned()),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[2], addr: msg.addr, arg_count: 2})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[2], addr: msg.addr, arg_count: 2})),
} }
} }
return Ok(VmcExtRvc { return Ok(VmcExtRvc {
@ -906,51 +906,51 @@ impl MessageBehavior for VmcExtLight {
let mut color = Color::from_rgba(0.0, 0.0, 0.0, 0.0); let mut color = Color::from_rgba(0.0, 0.0, 0.0, 0.0);
match &msg.args[0] { match &msg.args[0] {
OscType::String(s) => name = s.to_owned(), OscType::String(s) => name = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match msg.args[1] { match msg.args[1] {
OscType::Float(f) => origin.x = f, OscType::Float(f) => origin.x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
match msg.args[2] { match msg.args[2] {
OscType::Float(f) => origin.y = f, OscType::Float(f) => origin.y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[2], addr: msg.addr, arg_count: 2})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[2], addr: msg.addr, arg_count: 2})),
} }
match msg.args[3] { match msg.args[3] {
OscType::Float(f) => origin.z = f, OscType::Float(f) => origin.z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[3], addr: msg.addr, arg_count: 3})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[3], addr: msg.addr, arg_count: 3})),
} }
match msg.args[4] { match msg.args[4] {
OscType::Float(f) => quat.x = f, OscType::Float(f) => quat.x = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[4], addr: msg.addr, arg_count: 4})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[4], addr: msg.addr, arg_count: 4})),
} }
match msg.args[5] { match msg.args[5] {
OscType::Float(f) => quat.y = f, OscType::Float(f) => quat.y = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[5], addr: msg.addr, arg_count: 5})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[5], addr: msg.addr, arg_count: 5})),
} }
match msg.args[6] { match msg.args[6] {
OscType::Float(f) => quat.z = f, OscType::Float(f) => quat.z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[6], addr: msg.addr, arg_count: 6})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[6], addr: msg.addr, arg_count: 6})),
} }
match msg.args[7] { match msg.args[7] {
OscType::Float(f) => quat.w = f, OscType::Float(f) => quat.w = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[7], addr: msg.addr, arg_count: 7})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[7], addr: msg.addr, arg_count: 7})),
} }
match msg.args[8] { match msg.args[8] {
OscType::Float(f) => color.r = f, OscType::Float(f) => color.r = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[8], addr: msg.addr, arg_count: 8})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[8], addr: msg.addr, arg_count: 8})),
} }
match msg.args[9] { match msg.args[9] {
OscType::Float(f) => color.g = f, OscType::Float(f) => color.g = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[9], addr: msg.addr, arg_count: 9})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[9], addr: msg.addr, arg_count: 9})),
} }
match msg.args[10] { match msg.args[10] {
OscType::Float(f) => color.b = f, OscType::Float(f) => color.b = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[10], addr: msg.addr, arg_count: 10})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[10], addr: msg.addr, arg_count: 10})),
} }
match msg.args[11] { match msg.args[11] {
OscType::Float(f) => color.a = f, OscType::Float(f) => color.a = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[11], addr: msg.addr, arg_count: 11})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[11], addr: msg.addr, arg_count: 11})),
} }
return Ok(VmcExtLight { return Ok(VmcExtLight {
name, name,
@ -989,16 +989,16 @@ impl MessageBehavior for VmcExtVrm {
let mut hash: Option<String> = None; let mut hash: Option<String> = None;
match &msg.args[0] { match &msg.args[0] {
OscType::String(s) => path = s.to_owned(), OscType::String(s) => path = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match &msg.args[1] { match &msg.args[1] {
OscType::String(s) => title = s.to_owned(), OscType::String(s) => title = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
if msg.args.len() == 3 { if msg.args.len() == 3 {
match &msg.args[2] { match &msg.args[2] {
OscType::String(s) => hash = Some(s.to_owned()), OscType::String(s) => hash = Some(s.to_owned()),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[2], addr: msg.addr, arg_count: 2})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[2], addr: msg.addr, arg_count: 2})),
} }
} }
return Ok(VmcExtVrm { path, title, hash }); return Ok(VmcExtVrm { path, title, hash });
@ -1028,11 +1028,11 @@ impl MessageBehavior for VmcExtRemote {
let json: String; let json: String;
match &msg.args[0] { match &msg.args[0] {
OscType::String(s) => service = s.to_owned(), OscType::String(s) => service = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match &msg.args[1] { match &msg.args[1] {
OscType::String(s) => json = s.to_owned(), OscType::String(s) => json = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
return Ok(VmcExtRemote { service, json }); return Ok(VmcExtRemote { service, json });
} }
@ -1059,7 +1059,7 @@ impl MessageBehavior for VmcExtOpt {
option: s.to_owned(), option: s.to_owned(),
}) })
} }
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
} }
} }
@ -1087,19 +1087,19 @@ impl MessageBehavior for VmcExtSettingColor {
let mut color = Color::from_rgba(0.0, 0.0, 0.0, 0.0); let mut color = Color::from_rgba(0.0, 0.0, 0.0, 0.0);
match msg.args[0] { match msg.args[0] {
OscType::Float(f) => color.r = f, OscType::Float(f) => color.r = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match msg.args[1] { match msg.args[1] {
OscType::Float(f) => color.g = f, OscType::Float(f) => color.g = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
match msg.args[2] { match msg.args[2] {
OscType::Float(f) => color.b = f, OscType::Float(f) => color.b = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[2], addr: msg.addr, arg_count: 2})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[2], addr: msg.addr, arg_count: 2})),
} }
match msg.args[3] { match msg.args[3] {
OscType::Float(f) => color.a = f, OscType::Float(f) => color.a = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Float(0.0), actual: msg.args[3], addr: msg.addr, arg_count: 3})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[3], addr: msg.addr, arg_count: 3})),
} }
return Ok(VmcExtSettingColor { color }); return Ok(VmcExtSettingColor { color });
} }
@ -1152,7 +1152,7 @@ impl MessageBehavior for VmcExtSettingWin {
return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: i, addr: msg.addr, arg_count: 0})); return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: i, addr: msg.addr, arg_count: 0}));
} }
} }
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
match msg.args[1] { match msg.args[1] {
OscType::Int(i) => { OscType::Int(i) => {
@ -1162,15 +1162,15 @@ impl MessageBehavior for VmcExtSettingWin {
return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: i, addr: msg.addr, arg_count: 1})); return Err(FromMessageErr::IntRange(IntRangeErr { expected_lower: 0, expected_upper: 1, actual: i, addr: msg.addr, arg_count: 1}));
} }
} }
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[1], addr: msg.addr, arg_count: 1})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[1], addr: msg.addr, arg_count: 1})),
} }
match msg.args[2] { match msg.args[2] {
OscType::Int(i) => result.window_click_through = i, OscType::Int(i) => result.window_click_through = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[2], addr: msg.addr, arg_count: 2})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[2], addr: msg.addr, arg_count: 2})),
} }
match msg.args[3] { match msg.args[3] {
OscType::Int(i) => result.hide_border = i, OscType::Int(i) => result.hide_border = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::Int(0), actual: msg.args[3], addr: msg.addr, arg_count: 3})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[3], addr: msg.addr, arg_count: 3})),
} }
return Ok(result); return Ok(result);
} }
@ -1193,7 +1193,7 @@ impl MessageBehavior for VmcExtConfig {
} }
match &msg.args[0] { match &msg.args[0] {
OscType::String(s) => return Ok(VmcExtConfig { path: s.to_owned() }), OscType::String(s) => return Ok(VmcExtConfig { path: s.to_owned() }),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[0], addr: msg.addr, arg_count: 0})), _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
} }
} }
@ -1222,21 +1222,21 @@ impl MessageBehavior for VmcThru {
} }
return OscMessage { addr: self.addr.to_owned(), args} return OscMessage { addr: self.addr.to_owned(), args}
} }
fn from_osc_message(msg: OscMessage) -> Result<Self, String> { fn from_osc_message(msg: OscMessage) -> Result<Self, FromMessageErr> {
if msg.args.len() > 2 || msg.args.len() < 1 { if msg.args.len() > 2 || msg.args.len() < 1 {
return Err(String::from("arg count invalid")); return Err(FromMessageErr::ArgCount(ArgCountErr { expected_in: vec![1, 2], actual: msg.args.len(), addr: msg.addr}));
} }
let arg1: String; let arg1: String;
match &msg.args[0] { match &msg.args[0] {
OscType::String(s) => arg1 = s.to_owned(), OscType::String(s) => arg1 = s.to_owned(),
_ => return Err(String::from("arg type invalid")) _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0], addr: msg.addr, arg_count: 0})),
} }
let mut arg2: Option<ThruType> = None; let mut arg2: Option<ThruType> = None;
if msg.args.len() == 2 { if msg.args.len() == 2 {
match msg.args[1] { match msg.args[1] {
OscType::Int(i) => arg2 = Some(ThruType::Int(i)), OscType::Int(i) => arg2 = Some(ThruType::Int(i)),
OscType::Float(f) => arg2 = Some(ThruType::Float(f)), OscType::Float(f) => arg2 = Some(ThruType::Float(f)),
_ => return Err(String::from("arg type invalid")) _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0), OscType::Float(0.0)], actual: msg.args[1], addr: msg.addr, arg_count: 1}))
} }
} }
return Ok(VmcThru { addr: msg.addr, arg1 , arg2 }) return Ok(VmcThru { addr: msg.addr, arg1 , arg2 })