Skip to content

Commit

Permalink
Make comments better
Browse files Browse the repository at this point in the history
  • Loading branch information
monoid committed Jan 7, 2024
1 parent d247f90 commit fe8c1fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ pub(super) fn handle_prev_state<'i>(
RequestSentBy(Sender::PeerIdWithCallId { ref peer_id, call_id })
if peer_id.as_str() == exec_ctx.run_parameters.current_peer_id.as_str() =>
{
// call results are identified by call_id that is saved in data
// call results are identified by call_id that is saved in data;
// for compatiblity with JavaScript with binary formats, string IDs are used
let call_id = call_id.to_string();
match exec_ctx.call_results.remove(&call_id) {
Some(call_result) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ use serde_json::Value as JValue;
use std::collections::HashMap;

/// This is a map from a String to a service result for compatibility with JavaScript.
/// Binary format implementations like `rmp-serde` do not bother converting keys from strings, unlike `serde_json`.
/// So, we do it manually for all formats.
/// Binary format implementations like `rmp-serde` do not convert keys from strings, unlike `serde_json`.
pub type CallResults = HashMap<String, CallServiceResult>;
pub const CALL_SERVICE_SUCCESS: i32 = 0;

Expand Down Expand Up @@ -58,6 +57,7 @@ impl CallServiceResult {
pub fn ok(result: &JValue) -> Self {
Self {
ret_code: CALL_SERVICE_SUCCESS,
// for compatiblity with JavaScript with binary formats, string IDs are used
result: result.to_string(),
}
}
Expand Down

0 comments on commit fe8c1fc

Please sign in to comment.