|
|
@ -28,10 +28,13 @@ impl FromValue for f32 {
|
|
|
|
fn from_value(&mut self, value: Value) {
|
|
|
|
fn from_value(&mut self, value: Value) {
|
|
|
|
if value.is_f64() {
|
|
|
|
if value.is_f64() {
|
|
|
|
*self = value.as_f64().unwrap() as f32;
|
|
|
|
*self = value.as_f64().unwrap() as f32;
|
|
|
|
|
|
|
|
}else if value.is_i64() {
|
|
|
|
|
|
|
|
*self = value.as_i64().unwrap() as f32;
|
|
|
|
|
|
|
|
}else if value.is_u64() {
|
|
|
|
|
|
|
|
*self = value.as_u64().unwrap() as f32;
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
error!("Setting expected an f32, but received {:?}", value);
|
|
|
|
error!("Setting expected an f32, but received {:?}", value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -81,6 +84,8 @@ impl FromValue for bool {
|
|
|
|
fn from_value(&mut self, value: Value) {
|
|
|
|
fn from_value(&mut self, value: Value) {
|
|
|
|
if value.is_bool() {
|
|
|
|
if value.is_bool() {
|
|
|
|
*self = value.as_bool().unwrap();
|
|
|
|
*self = value.as_bool().unwrap();
|
|
|
|
|
|
|
|
}else if value.is_u64() {
|
|
|
|
|
|
|
|
*self = value.as_u64().unwrap() != 0;
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
error!("Setting expected a string, but received {:?}", value);
|
|
|
|
error!("Setting expected a string, but received {:?}", value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|