Make serialization full-fidelity

This commit is contained in:
Jonathan Turner
2019-06-30 18:46:49 +12:00
parent 5cac3d1135
commit c3697c67ca
13 changed files with 120 additions and 69 deletions

View File

@@ -68,28 +68,31 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
Value::Primitive(Primitive::Bytes(b)) => {
send_response(vec![ReturnValue::Value(Value::bytes(
b + inc_by as u128,
b + inc_by as u64,
))]);
}
_ => {
x => {
send_response(vec![ReturnValue::Value(Value::Error(Box::new(
ShellError::string("Unrecognized type in stream"),
ShellError::string(format!("Unrecognized type in stream: {:?}", x)),
)))]);
}
},
Ok(NuCommand::quit) => {
break;
}
Err(_) => {
Err(e) => {
send_response(vec![ReturnValue::Value(Value::Error(Box::new(
ShellError::string("Unrecognized type in stream"),
ShellError::string(format!(
"Unrecognized type in stream: {} {:?}",
input, e
)),
)))]);
}
}
}
Err(_) => {
send_response(vec![ReturnValue::Value(Value::Error(Box::new(
ShellError::string("Unrecognized type in stream"),
ShellError::string(format!("Unrecognized type in stream: {}", input)),
)))]);
}
}

View File

@@ -53,7 +53,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
Value::Primitive(Primitive::Bytes(b)) => {
total += b as i64;
send_response(vec![ReturnValue::Value(Value::bytes(total as u128))]);
send_response(vec![ReturnValue::Value(Value::bytes(total as u64))]);
}
_ => {
send_response(vec![ReturnValue::Value(Value::Error(Box::new(